xmlpoke

Xmlpoke to add multiple appsettings key doesn't work

亡梦爱人 提交于 2020-01-16 19:12:13
问题 I have a Msbuild target that gets executed successfully by adding a single key called 'ProjectID' to the appsetting section of web.config. Now am changing the behavior of this target by adding one more key 'ApplicationId' to the same appsetting section. The log shows the xmlpoke is executed for both. But only the projectID value is correctly replaced with every run. (Excerpt from)PropertyGroup definition: <?xml version="1.0" encoding="utf-8" ?> <Project ToolsVersion="15.0" DefaultTargets=

XmlPoke and unique nodes

扶醉桌前 提交于 2019-12-23 09:56:27
问题 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

XmlPoke and unique nodes

谁说胖子不能爱 提交于 2019-12-23 09:55:50
问题 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

How can I use MSBuild 'afterbuild' tasks to edit a .config file?

≯℡__Kan透↙ 提交于 2019-12-05 18:28:09
I have a .config in a target project and I need to add a line to it programmatically via an MSBuild task. Pseduo operations like: find target .config file determine the value of attributes for new node (e.g. 'id' and 'version' for 'package' node) insert new node in correct parent node save changes The .config file at $TargetProjectDir\Config\packages.config: <?xml version="1.0" encoding="utf-8"?> <packages> <package id="ABC" version="1.1.0.4" /> <package id="XYZ" version="2.0.0.0" /> </packages> Needs to look like this afterwards: <?xml version="1.0" encoding="utf-8"?> <packages> <package id=

How can I use Nant's xmlpoke target to remove a node

女生的网名这么多〃 提交于 2019-12-03 16:00:07
问题 Given the following xml: <rootnode> <childnode arg="a">Content A</childnode> <childnode arg="b">Content A</childnode> </rootnode> Using XMLPoke with the following XPath: rootnode/childnode[arg='b'] The result (if the replace string is empty) is: <rootnode> <childnode arg="a">Content A</childnode> <childnode arg="b"></childnode> </rootnode> The contents of the childnode have been removed when we actually want the childnode itself removed. The desired result is: <rootnode> <childnode arg="a"