public void how_to_convert_DTE_project_to_MsBuildProject() { // Say you got a DTE project somehow. EnvDTE.Project dteProject = this.DteLibrary; Microsoft.Build.Evaluation.Project msbuildProject = dteProject.Adapt().AsMsBuildProject(); Assert.IsNotNull(msbuildProject); // Access the MSBuild imports, for example Assert.IsTrue(msbuildProject.Imports.Count > 0); }
public void how_to_convert_DTE_project_to_VSProject() { // Say you got a DTE project somehow. EnvDTE.Project dteProject = this.DteLibrary; VSLangProj.VSProject vsProject = dteProject.Adapt().AsVsLangProject(); Assert.IsNotNull(vsProject); // Use the project, for example, to create the Web References folder EnvDTE.ProjectItem folder = vsProject.CreateWebReferencesFolder(); Assert.IsNotNull(folder); }
public void how_to_convert_DTE_project_to_IVsProject() { // Say you got a DTE project somehow. EnvDTE.Project dteProject = this.DteLibrary; IVsProject vsProject = dteProject.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); }
public void how_to_convert_DTE_project_to_IProjectNode() { // Say you got a DTE project somehow. EnvDTE.Project dteProject = this.DteLibrary; IProjectNode projectNode = dteProject.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); }