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?
Set InstallPath registry key using Visual Studio Setup project
registryvisual-studio-setup-projewindows-installer
Related Solutions
This is originally from Sara's blog.
It also works with almost any version of Visual Studio, you just need to change the "8.0" in the registry key to the appropriate version number for your version of Visual Studio.
The guide line shows up in the Output window too. (Visual Studio 2010 corrects this, and the line only shows up in the code editor window.)
You can also have the guide in multiple columns by listing more than one number after the color specifier:
RGB(230,230,230), 4, 80
Puts a white line at column 4 and column 80. This should be the value of a string value Guides
in "Text Editor" key (see bellow).
Be sure to pick a line color that will be visisble on your background. This color won't show up on the default background color in VS. This is the value for a light grey: RGB(221, 221, 221).
Here are the registry keys that I know of:
Visual Studio 2010: HKCU\Software\Microsoft\VisualStudio\10.0\Text Editor
Visual Studio 2008: HKCU\Software\Microsoft\VisualStudio\9.0\Text Editor
Visual Studio 2005: HKCU\Software\Microsoft\VisualStudio\8.0\Text Editor
Visual Studio 2003: HKCU\Software\Microsoft\VisualStudio\7.1\Text Editor
For those running Visual Studio 2010, you may want to install the following extensions rather than changing the registry yourself:
http://visualstudiogallery.msdn.microsoft.com/en-us/0fbf2878-e678-4577-9fdb-9030389b338c
http://visualstudiogallery.msdn.microsoft.com/en-us/7f2a6727-2993-4c1d-8f58-ae24df14ea91
These are also part of the Productivity Power Tools, which includes many other very useful extensions.
In the service project do the following:
- In the solution explorer double click your services .cs file. It should bring up a screen that is all gray and talks about dragging stuff from the toolbox.
- Then right click on the gray area and select add installer. This will add an installer project file to your project.
- Then you will have 2 components on the design view of the ProjectInstaller.cs (serviceProcessInstaller1 and serviceInstaller1). You should then setup the properties as you need such as service name and user that it should run as.
Now you need to make a setup project. The best thing to do is use the setup wizard.
Right click on your solution and add a new project: Add > New Project > Setup and Deployment Projects > Setup Wizard
a. This could vary slightly for different versions of Visual Studio. b. Visual Studio 2010 it is located in: Install Templates > Other Project Types > Setup and Deployment > Visual Studio Installer
On the second step select "Create a Setup for a Windows Application."
On the 3rd step, select "Primary output from..."
Click through to Finish.
Next edit your installer to make sure the correct output is included.
- Right click on the setup project in your Solution Explorer.
- Select View > Custom Actions. (In VS2008 it might be View > Editor > Custom Actions)
- Right-click on the Install action in the Custom Actions tree and select 'Add Custom Action...'
- In the "Select Item in Project" dialog, select Application Folder and click OK.
- Click OK to select "Primary output from..." option. A new node should be created.
- Repeat steps 4 - 5 for commit, rollback and uninstall actions.
You can edit the installer output name by right clicking the Installer project in your solution and select Properties. Change the 'Output file name:' to whatever you want. By selecting the installer project as well and looking at the properties windows, you can edit the Product Name
, Title
, Manufacturer
, etc...
Next build your installer and it will produce an MSI and a setup.exe. Choose whichever you want to use to deploy your service.
Best Answer
Actually, while I was searching for the same thing the following solution was also mentioned:
use [TARGETDIR] in the registry key.