Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set InstallPath registry key using Visual Studio Setup project

I am deploying my application using an msi installer designed with a Visual Studio Setup Project. How do I set a registry key to the application's install path?

like image 339
kjv Avatar asked Jul 21 '09 16:07

kjv


2 Answers

Actually, while I was searching for the same thing the following solution was also mentioned:

use [TARGETDIR] in the registry key.

like image 118
Cohen Avatar answered Oct 12 '22 00:10

Cohen


One way to do this would be to create a custom action in your installer. On the custom action you could provide CustomActionData "/Path="[TARGETDIR]*". Within your custom action code you can reference Context.Parameters["Path"] and receive the installation path passed from the installer in your .NET code.

Now that you have the [TARGETDIR] within your custom action code you can continue to use the Microsoft.Win32 namespace to set the registry key.

HTH - Wil

like image 25
Wil P Avatar answered Oct 12 '22 00:10

Wil P