我正在尝试使用NSIS覆盖我的应用程序.config文件中的现有值。
我想要更改'endpoint address="http://DefaultWebService.asmx"‘
设置为'endpoint address="http://MyWebService.asmx"‘
我的配置文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<client>
<endpoint address="http://DefaultWebService.asmx"
binding="customBinding" bindingConfiguration="MyServiceSoap12"
contract="WebServiceProxies.MyServiceSoap" name="MyServiceSoap12" />
</client>
</system.serviceModel>
</configuration>在我的NSIS中,我使用:
WriteIniStr "$MyApp.exe.config" "system.serviceModel" "endpoint address" "endpoint address="http://MyWebService.asmx"但这只会增加
[system.serviceModel]
endpoint address=http://MyWebService.asmx添加到.config文件的底部。
我哪里错了?
谢谢
发布于 2012-04-11 20:46:58
问题是您使用的是WriteIniStr,它更新.ini文件,而application.config是一个XML文件。您需要使用像this插件这样的插件。
https://stackoverflow.com/questions/10105299
复制相似问题