Page 1 of 1

Run Installer and be able to run again

Posted: Fri Oct 02, 2009 3:09 pm
by ssloka
I would like to run the installer and be able to run it over and over on a machine. Each time it would be running an update program, sort of like a patch in a sense.

Is there a way to be able to run the installer over and over and not place icons in the Add/Remove programs?

Thanks,

~ Steve

Posted: Fri Oct 02, 2009 3:33 pm
by neillans
Sure this is possible, but you will need to modify the MSI code script ... a lot.

Posted: Fri Oct 02, 2009 3:34 pm
by ssloka
Great! What would be the things to think about when doing this?

Posted: Tue Oct 06, 2009 6:40 am
by paulm
I'm still evaulating IA9 and this is one of the requirements for our installs :D


Our requirements were:

1 - install version 1.0 - installer asks the relevant questions for the configuration, does the install and sets up the config files (all settings are held in app.config file)

2 - install version 1.1 which is a full install not a patch - it detects version 1, and replaces the files application files - installer doesn't remove the config files and doesn't ask the config questions again as they were already answered for version 1.0. If version 1.0 is not detected then the install works as normal asking all the questions, etc...

So, this is what I did:

Setup the install to copy all files as normal - but, marked the app.config file as a Permanent File and Never Overwrite. This stops the 1.1 install removing the file / over-writing the settings


In the MSI Code I did the following:

1 - Define Global Persistent Variable QUESTIONS1_ANSWERED set to FALSE

2 - Define Global Variable SETTINGSFILE set to $COMMONFILES$\\$COMPANY$\\$TITLE$.txt (you need to create this folder if it doesn't exist)

3 - In section Setup User Interview - after the First Time Install sets the TargetDir and Start Menu variables do the following:
Does File Exist $SETTINGSFILE$
if TRUE call Load Feature Selections from $SETTINGSFILE$.

When running version 1.1 install this will load the QUESTIONS1_ANSWERED flag if version 1.0 install has already been run

4 - Before displaying each install dialog that asks a question check is variable QUESTIONS1_ANSWERED is FALSE - this stops the installer asking the questions when you do the next install. Something like:

label : blah
if Variable QUESTIONS1_ANSWERED Equals False
Display Dialog ....
end
if Varaible WIZARD Equals BACK
Goto Label......

My installs so far always display the Welcome, Accept License and the Start Install dialogs - any other dialogs are checked against QUESTIONS1_ANSWERED


5 - In install section after the Apply Install is called do following:

if variable QUESTION1_ANSWERED is FALSE
Write information to app.config file

Once this is done do the following:
Does File Exist $SETTINGSFILE$.
If True then call DLL Function kernal32.dll -> DeleteFileA (pass in SETTINGSFILE as paramter) - this deletes the existing settings file.
Set Variable QUESTIONS1_ANSWERED to TRUE.
Call Save Feature Selections using $SETTINGSFILE$

6 - In un-install section before call to Apply Uninstall delete the $SETTINGSFILE$ if it exists (use Call DLL Function kernel32.dll -> DeleteFileA) and then do the same again to delete the app.config file as the MSI won't remove it.



Theory is when I get to version 3 that has to ask the user a new set of questions for a new configuration section then I just need to add QUESTIONS2_ANSWERED persistent variable and display the dialogs as required.


Hope that makes sense / hope it helps - I'm sure people will find ways to break it but its a start :D In fact - IA guys - can you see any problems with this approach?


Paul