I am trying to use an xmlpoke task to update a VS Project File (which is XML). In the Project root, there are multiple PropertyGroup nodes, I am trying to select the first one. The XML looks like this
<Project>
<PropertyGroup>
</PropertyGroup>
<PropertyGroup>
</PropertyGroup>
<PropertyGroup>
</PropertyGroup>
</Project>
I am using an xpath of //Project/PropertyGroup[1]
to get the first PropertyGroup, but I get the error: “Non-unique xpath given //Project/PropertyGroup[1]”.
edit: sorry, I didn't think it mattered (but it does), Project has a namespace. I put the correct XML with the correct xmlpoke as an answer for any future searchers.
Ok, I simplified the XML snippet above too much -- I think someone would have figured it out if I hadn't. The answer is that since Project has a namespace, it needs to be like this
For reference, the Project tag looks like this: