Question

I need to create setup.exe for my abc project (written in c++). Before running the setup.exe i need to create and set the environment variable to some value. Is it possible to add custom action of "creating and set the value of environment variable" in the installer and if yes then how.

I'm using VS 2012 and Installshield.

Thanks

Was it helpful?

Solution

You don't describe your root problem but I can give you advice on environment variable race conditions I've had in the past. Typically I'll have my installer use standard techniques (Windows Installer Environment table which updates the registry and broadcasts a settings change) and then if still have a race condition for custom code running in the installer I'll have the custom action set the environment for the process to work around the issue. This way the permanent change is done correctly and a temporary change is injected to make the custom action happy.

The two most commonly seen race conditions are:

1) Variations of a child process hosted by a windows service doesn't get the settings change message due to service control manager behavior

2) A pending reboot causes MSI to not send the settings change message. In this scenario it is also possible to write a custom action that does nothing but send the message after the standard action has done it's work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top