Archive: Mulitple installation.


Mulitple installation.
I need to install multiple instances of an application using NSIS. I have a custom page that obtains information about the install (ie. instance name that defines that install). The instance name obtained form the screen will be appended to the generic default installation folder (using STRCPY $INSTDIR "$INSTDIR\$instanceName" ).

My question is that I want to define values using !define based on the instance name.

Am I able to modify the value (i.e. REGKEY for that instance) that I previously defined prior to the !insertmacro sequence once I have the instance name from the custom page? If not, is there a work around?

Thanks.


I'm not quit sure I understand. :confused:

!define is used at compile time, which means you can't !define something at runtime based on user input.

But you could set one or more variables or turn on/off different sections at runtime to control how each instance is installed.


Thank you. I am new to NSIS and after reading the documentation more closely I realised they were compile time constants. I was able to work around it by modifying a few variables with STRCPY.


I have the exact same requirement. I need our support staff to be able to install a test installation and a production installation of the same package on the same server.

What variables did you modify? The three things I have figured out that need to be changed are:

PRODUCT_UNINST_KEY
MUI_STARTMENUPAGE_DEFAULTFOLDER
InstallDir

I am currently unable to make any of these dynamic, i.e., specified by the user selecting from a radio button list. Two of them are constant !defines and InstallDir can't be executed from within a Function.


What I ended up doing to "solve" this problem was injecting tokens into my installer script that my NAnt script replaces at time of continuous integration.

Something like this:

!define PRODUCT_NAME "My Product %ENVIRONMENT%"

where %ENVIRONMENT% is replaced with Test and Prod. The drawback to doing this is I have to effectively build the installer twice. This can be a very time-consuming process for bigger installers.