R – ASP.NET project installer registry key

asp.netinstallationsetup-projectweb-setup-project

I have a asp.net project, and wrote a web installer.
The setup exe/msi copies that project in directory chosen by the installing user, and creates an application for it.

How can I get the path my asp.net application got installed to (in the installer)?
I want to write the physical path of my ASP.net application into the registry, because a windows service needs to watch a directory of this web project, and it can't do that, unless it knows where the web project was installed to.

Does the Webinstaller project by any chance write this value into the registry automatically ?

Best Answer

It is possible:

Right-click on the setup project, and choose View->Registry from the context menu.
Right-click on HKEY_Local_Machine, add a new key, call it Software.
Right click on Software, add a new key, call it "MyCompanyName".
Right click on MyCompanyName, from the context-menu, choose new->String call it installation folder.
Left click on the installationFolder key, and set property value to [TARGETDIR]
Add an additional string key, call it version and give it the value [ProductVersion]

including the []


On x64, you'll find your registry key in regedit under
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\YourCompany]


But programmatically, you can read it normally, from normal projects and web projects, with:
My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\YourCompanyName", "Installation Folder", Nothing)