我正在使用 MSBuild 社区任务的 Nightly build 1.3.0.477 并且我遇到了 XmlMassUpdate 的问题。
这是我想要做的:
对于每个项目,如果它不引用 CommonAssemblyInfo.cs 文件,请添加该引用。
我这样做是这样的:
<Message Text="Path is $(MSBuildCommunityTasksPath)" Importance="normal" />
<!---->
<XmlMassUpdate ContentFile="%(DotNetProjects.FullPath)"
ContentRoot="msb:Project/msb:ItemGroup[2]/msb:Compile[1]"
NamespaceDefinitions="msb=http://schemas.microsoft.com/developer/msbuild/2003"
SubstitutionsFile="$(BuildFolder)CommonAssemblyInfo.substitution"
SubstitutionsRoot="ItemGroup/Compile" />
我的替换文件如下所示:
<ItemGroup>
<Compile Include="..\..\CommonAssemblyInfo.cs" >
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
问题是,当我运行目标时,它会将空 xmlns 添加到 Link 标签,这是非法的。
<ItemGroup>
<Compile Include="Class1.cs">
<Link xmlns="">Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
我如何告诉它不要这样做?