Thursday, February 18, 2010

Specify a (Default) value for a registry key in an MSI

After reading a few interesting posts about why there is a (Default) value for a key in the Windows registry, I got down to the task of specifying a REG_SZ value for said (Default). I got a clue of how to do this when I read the following:
To read the unnamed (default) registry value, enter the key path without name (with trailing backslash character). For example: "Software\Microsoft\Windows\"
Bearing this in mind, I followed these steps to specify a (Default) value for a key in the MSI I am building via Visual Studio:

1. Right Click on the Setup project -> Select View -> Registry
2. Construct the path to your registry key. In this case, I was creating a new key for the AWSSDK assembly as HKLM\Software\Microsoft\.NETFramework\AssemblyFolders\AWSSDK.
3. Right click on the AWSSDK node and select "String Value"
4. Leave the "Name" field blank in the properties window but specify the correct value; in this case, it was the installation path for the SDK.

When you have entered a value, you will notice that the empty name field gets replaced by (Default).

This is a good explanation of why there is a (Default) value for registry keys: Why do registry keys have a default value?

Also, the Microsoft Orca tool is a great aid when debugging MSI issues. You can get Orca by downloading and installing the package from :here:

No comments:

Post a Comment