PDA

View Full Version : Editing xml file during installation



jmv3432
12-15-2016, 06:42 PM
So I have a configuration xml file that is set to be installed with my software. The xml file has some fields, for example the web address of a backend server.

I want to be able to prompt for user input to get the information during the installation to fill out these xml fields.

I'm trying to accomplish this in a basic msi project. Any insights or suggestions on how to complete this would be greatly appreciated.

Edit:

So I've made some head way, I think I will accomplish this by creating a custom dialog. However I'm not sure how to get the information that is inputted in a dialog text field into my xml.

chad.petersen
12-16-2016, 01:36 PM
Set the edit control in your dialog to have some know Property: and use ALL UPPERCASE for that Property so it is a Global Property - makes it survive between the UI and Execute sequence this way.

Then in the "XML File Changes" go to your file and on the Advanced tab you can specify the Attributes or Elements you wish to change and Include your new Property in the appropriate location to do your text substitution.

Maybe helps you a little further along?

Chad

jmv3432
12-16-2016, 02:32 PM
Thanks a bunch Chad! That did the trick!

So for anyone in the future here is what I did:


Create a custom dialog (Under User Interface/Dialogs)
Create dialog with edit fields. Name them as you like, but properties of each should be all uppercase (ex. APIURL or MACHINENAME)
In text file changes or XML file changes, create a change as you would normally
When trying to get your text from the text field, write it as such: [EXAMPLEPROPERTY] (Using [] gets the value)


This stack overflow post helped a bit when it came to editing and replacing text:
http://stackoverflow.com/questions/6783585/modifying-config-file-while-installing-with-installshield-2011

Then finally you need to place your dialog into your installer. You can do this under Behavior and Logic -> Custom Actions and Sequences