tags:

views:

85

answers:

3

I'm trying to save an install path to the registry so my windows service will know where my other application was installed.

I'm using visual studio's deployment to create a registry value in HKEY_CURRENT_USER, but my windows service which runs under LocalMachine doesn't have access to that. I then made the installer create a registry value in HKEY_LOCAL_MACHINE, but when I view the registry after the install it appears it never made the value. Any ideas?

+1  A: 

You dont need to make one of your own. The msi will actually set one for you, it can be found in

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{ProductGUID}\InstallLocation

EDIT

I have just had a look and it appears that it doesn't get set every time...

Charles Gargent
A: 

It's possible that you don't have the installer set to ask for privilege elevation, and that it's installing it in the per-user virtualized registry.

Check HKEY_CLASSES_ROOT\VirtualStore\Machine. If your key is there, you need to set your installer to ask for elevation.

sblom
A: 

Turns out that it was written to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ instead of HKEY_LOCAL_MACHINE\SOFTWARE\ because I'm running 64 bit windows.

Robert