Beispiel #1
0
        public void how_to_convert_MSBuild_Project_to_DTE_Project()
        {
            // Say you got an MSBuild Project somehow.
            Microsoft.Build.Evaluation.Project project = this.MsBuildLibrary;

            EnvDTE.Project dteProject = project.Adapt().AsDteProject();

            Assert.IsNotNull(dteProject);

            // Use the DTE project API, such as to save the project:
            dteProject.Save();
        }
Beispiel #2
0
        public void how_to_convert_MSBuild_Project_to_VsLangProject()
        {
            // Say you got an MSBuild Project somehow.
            Microsoft.Build.Evaluation.Project project = this.MsBuildLibrary;

            VSLangProj.VSProject vsProject = project.Adapt().AsVsLangProject();

            Assert.IsNotNull(vsProject);

            // Use the project, for example, to create the Web References folder
            EnvDTE.ProjectItem folder = vsProject.CreateWebReferencesFolder();
            Assert.IsNotNull(folder);
        }
Beispiel #3
0
        public void how_to_convert_MSBuild_Project_to_IVsProject()
        {
            // Say you got an MSBuild Project somehow.
            Microsoft.Build.Evaluation.Project project = this.MsBuildLibrary;

            IVsProject vsProject = project.Adapt().AsVsProject();

            Assert.IsNotNull(vsProject);

            // Use the VS project to open an item in a specific view, the designer, for example
            uint           itemId = 0;   // Get the item ID to open somehow, see other how-tos.
            IVsWindowFrame frame;
            Guid           viewId = VSConstants.LOGVIEWID.Designer_guid;

            vsProject.OpenItem(itemId, ref viewId, IntPtr.Zero, out frame);
        }
Beispiel #4
0
        public void how_to_convert_MSBuild_Project_to_IProjectNode()
        {
            // Say you got an MSBuild Project somehow.
            Microsoft.Build.Evaluation.Project project = this.MsBuildLibrary;

            IProjectNode projectNode = project.Adapt().AsProjectNode();

            Assert.IsNotNull(projectNode);

            // Now we can use Clide's project node API, such as accessing
            // the MSBuild properties using dynamic syntax.
            string assemblyName = projectNode.Properties.AssemblyName;

            Assert.AreEqual("ClassLibrary", assemblyName);

            // Or a property for a specific configuration
            string debugType = projectNode.PropertiesFor("Debug|AnyCPU").DebugType;

            Assert.AreEqual("full", debugType);
        }