Quantcast
Channel: MSBuild Extension Pack
Viewing all articles
Browse latest Browse all 1211

New Post: XMLFile Addelement - need to add 3 elements of same type but fails on 2nd?

$
0
0

I'm trying to use the XMLFile TaskAction AddElement to as follows:

Before:

<RenderingConfiguration>
    <RenderEngines>
    </RenderEngines>
</RenderingConfiguration>

After

<RenderingConfiguration>
    <RenderEngines>
      <RenderEngine ID="RE1" />
      <RenderEngine ID="RE2" />
      <RenderEngine ID="RE3" />
    </RenderEngines>
</RenderingConfiguration>

I have an Itemgroup set up with the 3 entries I want to add, and I'm using the following call to add the elements:

<XmlFile TaskAction="AddElement" File="pathtoxmlfile.xml" Element="RenderEngine" ParentElement="//RenderingConfiguration/RenderEngines" Key="ID" Value=%(Itemgroup.ID) />

Running thru the code, the output shows it adding the 1st RenderEngine entry with the correct ID, but then it doesn't add the 2nd and 3rd, so the output file ends up with:

<RenderingConfiguration>
    <RenderEngines>
      <RenderEngine ID="RE1" />
    </RenderEngines>
</RenderingConfiguration>

Am I doing something wrong?


Viewing all articles
Browse latest Browse all 1211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>