【发布时间】:2016-06-29 23:18:29
【问题描述】:
我想使用 MSbuild 目标任务添加一个新的连接字符串(如果存在,则用确切的名称替换它)。我知道MSbuild包含XmlPoke,但是命令可以修改一些节点或属性,但是如何添加一个新的呢?
之前:
<connectionStrings>
<add name="myDB" connectionString="myCredentials"/>
</connectionStrings>
之后:
<connectionStrings>
<add name="myDB" connectionString="myCredentials"/>
<add name="myCustomKeyAddedDuringMSBuild" connectionString="key=someCredentials" />
</connectionStrings>
但如果我的目标配置文件已经包含“myCustomKeyAddedDuringMSBuild”连接字符串,那么什么都不做。
【问题讨论】:
标签: .net msbuild connection-string