Search code examples
visual-studio-2008installationwindows-installersetup-deployment

How to add an entry to registry Run key via VS2008 setup and deployment


I'm creating a VS2008 installer script for my project.

I want to add a value to HKCU\Software\Microsoft\Windows\CurrentVersion\Run to run my EXE at start up.

Is there a way I can specify a reference to my executable ("Primary output from Project"), so that the installer script inserts the correct value into the registry when it runs?

I don't want to have to hard code the path and name for the executable in the registry value.


Solution

  • Windows Installer is a declarative programming language, not an imperative scripting language. [#FileKey] will also do the trick. I suggest reading the following two MSDN topics.

    Registry Table

    http://msdn.microsoft.com/en-us/library/aa371168(VS.85).aspx

    The registry table joins registry resources to their components.

    Formatted

    http://msdn.microsoft.com/en-us/library/aa368609(v=VS.85).aspx