public void how_to_convert_MSBuild_ProjectItem_to_IItemNode() { // Say you got an MSBuild ProjectItem somehow. Microsoft.Build.Evaluation.ProjectItem item = this.MsBuildLibrary.Items.First(pi => pi.UnevaluatedInclude == "Class1.cs"); IItemNode itemNode = item.Adapt().AsItemNode(); Assert.IsNotNull(itemNode); // Now use item node to expand it (show its nested items) itemNode.Expand(); }
public void how_to_convert_MSBuild_ProjectItem_to_VSProjectItem() { // Say you got an MSBuild ProjectItem somehow. Microsoft.Build.Evaluation.ProjectItem item = this.MsBuildLibrary.Items.First(pi => pi.UnevaluatedInclude == "Class1.cs"); VSLangProj.VSProjectItem vsItem = item.Adapt().AsVsLangItem(); Assert.IsNotNull(vsItem); // Now use item to force its custom tool to run. vsItem.RunCustomTool(); }
public void how_to_convert_MSBuild_ProjectItem_to_DTE_ProjectItem() { // Say you got an MSBuild ProjectItem somehow. Microsoft.Build.Evaluation.ProjectItem item = this.MsBuildLibrary.Items.First(pi => pi.UnevaluatedInclude == "Class1.cs"); EnvDTE.ProjectItem dteItem = item.Adapt().AsDteProjectItem(); Assert.IsNotNull(dteItem); // Now use DTE to delete the item, for example dteItem.Delete(); }