Wednesday, April 11, 2012

NSIS WriteIniStr

I am trying to overwrite an existing value in my Application .config file using NSIS.


I want to change 'endpoint address="http://DefaultWebService.asmx"'


to 'endpoint address="http://MyWebService.asmx"'


My Config file looks something like this:


<?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>
 


In my NSIS I'm using :


WriteIniStr "$MyApp.exe.config" "system.serviceModel" "endpoint address" "endpoint address="http://MyWebService.asmx"
 


but this just adds


[system.serviceModel]
 endpoint address=http://MyWebService.asmx
 


Where am I going wrong?


Thanks


Answer:

The problem is that you're using WriteIniStr which updates .ini files and application.config is an XML file. You need to use something like this plug-in instead.


plug-in:
http://nsis.sourceforge.net/XML_plug-in

No comments:

Post a Comment