views:

270

answers:

1

Hello all,

On my application Setup Project, I'm trying to setup a Registry key either under HKLM/Software or HKCU/Software depending on whether the user checked "All Users" or "Just Me" during the setup.

For that effect, I've been trying to use the ALLUSERS property and check it against either 1 or "", respectively.:

  • ALLUSERS = 1
  • ALLUSERS = ""

I have the keys AlwaysCreate property set to False. And yet when installing both HKLM/Software/*my_key* and HKCU/Software/*my_key* are created.

What am I missing?

Update: I've been trying other alternatives like enclosing ALLUSERS in square brackets, enabling the transitive property or using ALLUSERS != 1 instead of = "". To no avail. I gave up on this for now and am only creating under HKLM for both cases. But if anyone does have an answer I would really appreciate.

+1  A: 

My understanding of Windows Installer is that this behaviour is abstracted away so the developer doesn't need to worry about it. That is, if the ALLUSERS property is not set, your installation package will "automagically" put the registry keys in HKCU rather than HKLM. See the documentation on MSDN at http://msdn.microsoft.com/en-us/library/aa367559%28VS.85%29.aspx. Therefore, it sounds as though you are trying to reimplement this functionality through the setup project; I would suggest dropping the condition based on the ALLUSERS property.

As a side-note, the AlwaysCreate property controls under what circumstances the registry key will be created, specifically related to the contents of the key. By setting it to false, you are saying "don't create this key if it doesn't have any subkeys or values". Setting it to true means "create this key whether or not it has any subkeys or values". Documentation again available on MSDN at http://msdn.microsoft.com/en-us/library/e1t11k72%28VS.100%29.aspx.

alastairs
While it initially didn't solve my problem, you hinted me into what could be wrong. Thanks alastairs. The problem was related to this. I was doing something wrong. I was using the HKLM and HKCU hives and trying to conditionally set the keys. However I completely missed the last item on the Setup project registry editor. A conspicuous "User/Machine Hive". That's where I should have put my keys, and not directly under HKLM or HKCU. Silly me.
Krugar