Search code examples
visual-studio-2010registrywindows-installersetup-deployment

VS2010 Deployment Project: Issues with multi-user-install and registry entry


I have issues setting up my deployment project in Visual Studio 2010. Im using Windows 7 x64. Here's my problem:

The setup is supposed to install my program for all users. During the setup three registry keys are written to the HKEY_LOCAL_MACHINE/Software/Something folder, containing the setup variables for Serial, Name and Organization as values - [COMPANYNAME], [PIDKEY], [USERNAME].

What happens:

User1 (Admin) installs the software, entering his username, serial and company. Everything works. The keys can be found and values read by the program, using Registry.LocalMachine.OpenSubKey(path). The first thing I don't get is that I cannot find the registry entries, using the regedit.exe. Anyway, the code above finds them.

Now, User2 (Non-admin) tries to execute the freshly installed program. The installer is launched again, saying "Wait for ... to configure ...". The user specific folders for User2 are created correctly. The program is started, but the registry keys cannot be found by the program anymore.

Now, finally, User1 tries opening the program again. (The registry entries cannot be found anymore.) Edit: The registry entries are actually there, but its values are empty.

So, my questions:

  1. Why can't I see the registry entries with regedit after the install, although they are obviously there?

(2. Why are the registry entries deleted, when the second user tries launching the program for the first time and how can I avoid that?)

Edit: 2. Why are the registry values set to empty strings, when the second user tries launching the program for the first time and how can I avoid that?

Cheers from Auckland and thanks!

Marc


Solution

    1. You might be missing the registry entries if you have a 32 bit package installed on a x64 machine. In this case the registry entries would be redirected under "HKLM\Wow6432Node...". This is the standard behavior for x64 Windows machines. The same happens with the file redirection to Program Files and Program Files(x86).

    2. That is strange. It could happen that the second launch of the installer, a normal automatic repair operation, has removed the registry entries by mistake. To get more details about the actions executed during the second launch I recommend you enable permanent logging on the OS. http://support.microsoft.com/kb/223300