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

Closed Unassigned: InsertBeforeXPath does not work with XPath included [12864]

$
0
0
I am trying to add a new version element before all the existing version elements.

<XmlFile TaskAction="AddElement" Element="version" XPath="//database" InsertBeforeXPath="//database/version[1]" File="$(DBVersionsPath)"/>

Adds a new version element after the existing version element and ignores the InsertBeforeXPath.

I also tried
<XmlFile TaskAction="AddElement" Element="version" ParentElement="//database" InsertBeforeXPath="//database/version[1]" File="$(DBVersionsPath)"/>
but found there is a previously documented issue that you cannot add a duplicate Element unless you specify an XPath.

I can see how to work around either bug individually but not both combined.

-edit-
Solved my problem with
<XmlFile TaskAction="AddElement" Element="version" ParentElement="//db:database" InsertBeforeXPath="//db:database/db:version[1]" File="$(DBVersionsPath)" Namespaces="@(Namespaces)"/>
Was testing against a simplified version of the real xml, which didn't require Namespaces to be specified.
Comments: solved by user :-)

Viewing all articles
Browse latest Browse all 1211

Trending Articles



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