Installing A Startup Registry Key in A Setup Projects
Installing A Startup Registry Key in A Setup Projects
Here are the steps to install a startup registry key in a setup project in Visual Studio 2008.
3. Right click on the folders under HKEY_CURRENT_USER and select "New" and then "Key". You will
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run.
Some of the hierarchy may have already been created for you. If so, just start building your
"New" followed by "String Value". You should see a new value pop up in the pane on the right.
5. Rename the value on the pane on the right whatever you want to name it. It's customary to give
it a name that fits with your application, and it's fine to just put your application name as the
6. Set the Value property of your value. Right click on the value you just added, and select
"Properties Window". In the window, you'll see a field called "Value". This is where we want to put
in the path of the application to execute. Here's the catch: the default setup project allows the
user to specify where they would like to install the application, so this path can be variable. We
can capture the location where the application has been installed to by calling the "TARGETDIR"
variable. This variable has to be put in square brackets for the installer to recognize that it's a
dynamic value.
For example, if I want the application, named "MyApplication.exe" to run, I need to make the
[TARGETDIR]MyApplication.exe
When the installer is running, it will replace "[TARGETDIR]" with the directory to which the file was
the value that will be put in this registry key will be "C:\Program
Files\MyCompany\MyApplication\MyApplication.exe".
That's it! Now run the installer, reboot, and your application should run!