How to preserve application settings using XML filesCopy link to this sectionLink to this section copied!

When you design an installer using Advanced Installer you may want to take input from the user in order to configure the application more according to their needs.

You can do that in many ways such as saving the information in the registry or using the Advanced Installer support for saving the user input in XML/JSON/INI files.

Alternatively, for more specific cases, you can use a custom action to take the input from the user and save it in which way you may prefer.

This method is also the most powerful one, giving you more liberty to manipulate the data.

This article will show you how to save the user input, back it up and restore it when you roll out a major upgrade, using a custom action.

1. Preparing the dialogCopy link to this sectionLink to this section copied!

This step’s goal is creating the dialog in which the user will enter his data. Let’s say that you want the user to enter their email address and their phone number.

Create a new Enterprise or Architect project, then go to the Dialogs page and create a new dialog. Then, add the edit boxes in which the user will type their email address and phone number

Contact dialog

Now, you have to associate the edit boxes to the properties in which you will store the values given by the user

First edit prop

Second edit prop

2. Creating the XML fileCopy link to this sectionLink to this section copied!

Go to the Files and Folders page and create a new [|ProductName] folder in the Windows Volume directory. This folder will be located in the partition in which the Windows is installed and it will have the same name as the product.

In this folder, create a new XML file and give it a structure.

Xml elements

In the “contact_info” element, go to the Attributes tab and add two new attributes, one for each of the properties you want to store.

New attribute

New attribute email

Build the MSI and install the application.