Common entry point for installation and uninstallation.
Common entry point for installation and uninstallation.
In the MSIcode window is there a common place that both the installation and uninstallation would use? I can't quite see it if there is one. What I'm looking for is a place where I could create and initialise variables which I'd like to be eligible for use both when installing and uninstalling, that sort of thing. Another trivial example is maybe writing to a log file when the application is installed and uninstalled.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
Short version:
Entry point for booth is line 1.
Long version:
Booth the installer and uninstaller start at the top of the code and work their way through. In my setup that I'm working on currently (which I think is at least close to the default one generated if you use the wizard) what decides if it's installing or uninstalling is if the MAINTENANCE varible is set to true and NEEDSUPGRADE equals false then you are only uninstalling.
If NEEDSUPGRADE is set to true it will first uninstall and then go back and run the install part.
What I've done for easy access to all of my variables is simply placing them inside their own Code folding region at the top of the script. So the first thing the installer does is go through and initialize the varibles that I will need to install and uninstall. I've messed around alittle here and tried placing them different places and I can't see any difference preformance wise if I only initialize the varibles I need in order to install and not just do all like I do now.
Entry point for booth is line 1.
Long version:
Booth the installer and uninstaller start at the top of the code and work their way through. In my setup that I'm working on currently (which I think is at least close to the default one generated if you use the wizard) what decides if it's installing or uninstalling is if the MAINTENANCE varible is set to true and NEEDSUPGRADE equals false then you are only uninstalling.
If NEEDSUPGRADE is set to true it will first uninstall and then go back and run the install part.
What I've done for easy access to all of my variables is simply placing them inside their own Code folding region at the top of the script. So the first thing the installer does is go through and initialize the varibles that I will need to install and uninstall. I've messed around alittle here and tried placing them different places and I can't see any difference preformance wise if I only initialize the varibles I need in order to install and not just do all like I do now.
MSIcode regions.
A little off topic perhaps but is it possible to wrap code in a Define Region. I can see other regions but I can't find anything in the MSIcode window that would let me insert a region of my own. I guess it's possible but I can't see how to.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
-
MichaelNesmith
- Posts: 3452
- Joined: Thu Dec 22, 2005 7:17 pm
- Contact:
By the way folks, initializing variables all the way on top is fine, but pre-generated InstallAware scripts generally do this in the Define Setup Globals code folding region, and they initialize variables which should only be initialized on first run inside the Setup User Interview code folding region, right below the comment First Time Install. You can do the same or do it your way, nothing is hard coded in InstallAware, so do as you please 
One important note is if you do not want to re-initialize variables with default values on further runs of setup (i.e. you want the values assigned on first run, possibly by the end-user, to survive), check the Remember value when restarting setup option in the Set Variable command window.
One important note is if you do not want to re-initialize variables with default values on further runs of setup (i.e. you want the values assigned on first run, possibly by the end-user, to survive), check the Remember value when restarting setup option in the Set Variable command window.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Nice. I can see a use for that.MichaelNesmith wrote:One important note is if you do not want to re-initialize variables with default values on further runs of setup (i.e. you want the values assigned on first run, possibly by the end-user, to survive), check the Remember value when restarting setup option in the Set Variable command window.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP

