我想问一个关于 MSBuild 任务 XmlMassUpdate 行为的快速问题。
有没有人发现该任务只会将唯一节点复制到内容 XML 中?例如,如果我有一个客户端节点,它有多个称为端点的子节点,那么它只会大量复制第一个端点节点,而消除所有其他节点。
我在下面提供了一些我所描述的示例,非常感谢。
MSBuild 任务:
<Project DefaultTargets="Run" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.targets" />
<Target Name="Run">
<Delete Condition="Exists('web.config')" Files="web.config"/>
<XmlMassUpdate
ContentFile="app.config"
ContentRoot="configuration/system.servicemodel"
SubstitutionsFile="wcf.config"
SubstitutionsRoot="/system.servicemodel"
MergedFile="web.config"
/>
</Target>
</Project>
内容:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.servicemodel/>
</configuration>
替代品:
<?xml version="1.0" encoding="utf-8" ?>
<system.servicemodel>
<client>
<endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_LargeMessage"
contract="ClaimsService.IClaimsService"
name="WSHttpBinding_IClaimsService">
</endpoint>
<endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_LargeMessage"
contract="LateCertificationAdminService.ILateCertificationAdminService"
name="WSHttpBinding_ILateCertificationAdminService">
</endpoint>
</client>
</system.servicemodel>
输出:
<?xml version="1.0" encoding="utf-8" ?>
<system.servicemodel>
<client>
<endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_LargeMessage"
contract="ClaimsService.IClaimsService"
name="WSHttpBinding_IClaimsService">
</endpoint>
</client>
</system.servicemodel>