Click here to Skip to main content
15,881,801 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I am using the Visual Studio Installer Projects Extension for VS2013 (NOT ISLE).
I need to add an Environment variable during install and I can't seem to find any information on how to do this - (I'm sure it has got to do with my lack of googleing skills)

I'm leaning towards having to create a custom action, but I don't know how this would be done at all.

Any pointers would be received with great gratitude.

Best regards
Erik
Posted

Quote: I'm sure it has got to do with my lack of googleing skills
Not much skill required to type https://www.google.com/search?q=add+an+Environment+variable+during+install[^].
 
Share this answer
 
Comments
Erik Rude 2-Sep-14 8:52am    
Thanks for the help and interest Richard. I take it that the method is then indeed to use Custom Actions and I will get back here with a proper answer useful for others at a later time - when I've got one.
Conclusion:
OK, with all the stuff I then went through I ended up with the conclusion that I would be better off getting into WIX sooner rather than later. Since I've also had to get the installer working on a build server and I've got a few other installers that are more complex that I will also have to get working on the build server this seemed to be a reasonable route to take.

Some Links that will help anyone get started with CustomAction in VSInstallerProject
Here are two links I think I'll be using for creating the CustomAction for the installer - I'm going with vbs - of which I know little.

http://www.robvanderwoude.com/vbstech_data_environment.php[^]

https://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/[^]

I also found a codeproject article that may be partly applicable for basic information.
How to Pass Command Line Arguments to MSI Installer Custom Actions[^]

If all goes well I'll try to make a little tip or beginners article.
 
Share this answer
 
v2
OK, It's taken me a while to get back to this.
I did venture into WiX and it was the right decision for many reasons.
I then went through a lot of hoops - I think - to create some custom actions and all sorts of stuff to check if the Environment Variable existed already, what the value was and report back if it was an unexpected value - realising that changing it will/may ruin some other programmes. SO - in the end I went with NOT setting the Environment Variable in the Installer but instead setting it in the programme.
This works well - any processes spawned from my program will use these settings by default.
Environment.SetEnvironmentVariable(environmentVariableName, environmentVariableValue, EnvironmentVariableTarget.Process);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900