如何在构建自动更改连接字符串南特 [英] How to change connection string automatically on build with Nant
本文介绍了如何在构建自动更改连接字符串南特的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是它可以自动更改连接字符串在我的web.config时生成类型为发行采用南特?如果是这样,怎么样?谢谢
is it possible to change the connection string in my web.config automatically when build type is release using Nant? if so, how? thanks
推荐答案
我想你可以使用xmlpoke任务。例如,如果你的web.config是
I think you could use the xmlpoke task. For example, if your web.config is
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="myDb" connectionString="blah" providerName="blah"/>
</connectionStrings>
</configuration>
然后你可以添加一个任务,这样你的构建文件。
Then you could add a task to your build file like this.
<xmlpoke
file="path_to_your_web_root\Web.config"
xpath="/configuration/connectionStrings/add[@name='myDb']/@connectionString"
value="your_connection_string" />
呵呵,这里是xmlpoke任务的文档。 <一href="http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html">http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html
这篇关于如何在构建自动更改连接字符串南特的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文