MSBuild XmlMassUpdate Task

I wanted to ask a quick question about the behavior of the MSBuild XmlMassUpdate task.

Has anyone found that a task will only copy unique nodes into XML content? For example, if I have a node client that has several children called an endpoint, then it will only bulk copy the first endpoint of the node, deleting all the others.

I have given a few examples below what I am describing, many thanks in advance.

MSBuild Task:

<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>

Content:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.servicemodel/>
</configuration>

Replacement:

<?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>

Output:

<?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>
+5
source share
1 answer

The XmlMassUpdate help topic included in the MSBuildCommunityTasks help file shows examples of working with multiple items with the same name.

, XmlMassUpdate. name . , , xmu.

<?xml version="1.0" encoding="utf-8" ?>
<system.servicemodel>
    <client xmlns:xmu="urn:msbuildcommunitytasks-xmlmassupdate">
        <endpoint   xmu:key="name" 
                    binding="wsHttpBinding" 
                    bindingConfiguration="WSHttpBinding_LargeMessage"
                    contract="ClaimsService.IClaimsService"
                    name="WSHttpBinding_IClaimsService">
        </endpoint>
        <endpoint   xmu:key="name"
                    binding="wsHttpBinding" 
                    bindingConfiguration="WSHttpBinding_LargeMessage"
                    contract="LateCertificationAdminService.ILateCertificationAdminService"
                    name="WSHttpBinding_ILateCertificationAdminService">
        </endpoint>
    </client>
</system.servicemodel>
+6

All Articles