Blog Post

NSIS and updating xml file

Wednesday, February 24, 2016 12:11 PM

How to update xml as part of installation.

 

Scenario:

I have a installer that installs my application to specified location.

My user provides key using my installer and I want to apply the key into my xml config file.

nsisXML::create ;create instance

nsisXML::load "web.config" ; load file

nsisXML::select '/configuration/appSettings/add[@key="version"]' ; configuration path

  IntCmp $2 0 notFound ;if comparison fails go to notfound block

nsisXML::setAttribute "value" "1.0.0" ;  update value

nsisXML::save "web.config" ; save into file

notFound:

Plugin I have used to do this

http://nsis.sourceforge.net/NsisXML-_A_XML_parser_for_NSIS

that gives you all you should need

Blog
Products
Error pages
Links and tools