views:

2780

answers:

3

I would like to append a path to the PATH environment variable in a Visual Studio 2005 deployment project. How does one do this?

+1  A: 

You need to add a row to the Environment Table of the MSI file to do this. You can find information on that table here, http://msdn.microsoft.com/en-us/library/aa368369(VS.85).aspx. You can use Orca to do this or automate the procedure with some VB Script. The platform SDK contains the VB script file, WiRunSQL.vbs that can you used to automate build actions for your program.

LanceSc
+1  A: 

Use the registry editor view in the setup project and create the path key in the appropriate place ie. HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment and create a string value called "Path" and enter this as your value: "[%Path];[TARGETDIR]"

[%Path] is a placeholder for the original string in the existing Path value.

A: 

There are problems with the above mentioned approach of using the registry editor view and creating a key called PATH with value "[%Path];[TARGETDIR]". While the method works fine when installing the program, the default behavior during uninstall is to delete the entire PATH variable, not just the added [TARGETDIR]. I have not found a way to disable this behavior, although it seems like some conditional behavior might be possible.

Aaron Darling

related questions