我有一个msbuild项目文件:
<Project ToolsVersion="4.0" DefaultTargets="Build" ...">
<ItemGroup>
<ProjectReference Include="1.csproj">
<Project>{a1}</Project>
<Name>Some info1</Name>
</ProjectReference>
<ProjectReference Include="2.csproj">
<Project>{a2}</Project>
<Name>some info2</Name>
</ProjectReference>
</ItemGroup
我需要从&#39; ItemGroup中删除第二个节点ProjectReference
,如下所示:
<Project ToolsVersion="4.0" DefaultTargets="Build" ...">
<ItemGroup>
<ProjectReference Include="1.csproj">
<Project>{a1}</Project>
<Name>Some info1</Name>
</ProjectReference>
</ItemGroup
怎么做?我试过这个:
<TransformXml Source="$(ProjectPath)"
Transform="%(ProjectReference.Identity)"
Destination="$(ProjectPath)"
Condition=" '@(ProjectReference.Identity)'='1.csproj'" />
但它没有用。我也尝试过这个:
<XmlUpdate
XmlFileName="$(ProjectPath)"
XPath="//Project/ItemGroup/ProjectReference[@Include='%(ProjectReference.Identity)']"
Delete="true"
Condition=" '@(ProjectReference.Identity)'='1.csproj'"/>