The Visual Studio setup and deployment project has a Registry Editor which you can use to get your installer to add in your application registry keys and values. For instance, by using the Registry Editor, you can add in the registry keys under HKEY_LOCAL_MACHINE to set the Windows Path.
Underneath \\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment keys, you can add in a Environment String Path value with the string "[%Path];[TARGETDIR]", as shown below.
Once that is done, your installer will automatically set the Windows environment Path variable to include the path to your custom application's executable.
But there is a problem with this method: when you uninstall your custom application, the uninstaller will remove the Path string from the Registry. A better approach would be to create a small Custom Action program to add modify the Registry instead. I will post details about that method later here.
Honestly what is the point? I can't imagine anything more heinous than an uninstaller removing my Path variable. Glad I read to the end of this article.
ReplyDelete