Adding and Deleting Registry Values
You can use the Registry editor in Microsoft® Visual Studio® Installer to modify the target machine registry as necessary for your application installation. After your installation package (.msi) file installs your components and files on the target machine, it can write the associated registry keys and values to the system registry. You establish the keys and values your .msi file writes to the system registry by setting them up in the Registry editor.
This topic explains how to:
Add registry values.
Rename registry values.
Delete registry values.
For information about adding or deleting registry keys, see Adding and Deleting Registry Keys. For information about setting registry values, see Setting Registry Values.
Note The best place to create and maintain registry values specific to your installed application is in the HKEY_LOCAL_MACHINE\SOFTWARE\YOUR COMPANY NAME\YOUR APPLICATION NAME registry key. This helps prevent clashes between your registry values and other values.
To add registry values
In the Project Explorer window, expand the Target Machine node under your installer project.
Double-click Registry in the Target Machine node.
The Registry editor is displayed.
In the Registry on Target Machine hierarchy, right-click the node representing the registry key or subkey where you want to add a registry value. For example, right-click the SOFTWARE key (under HKEY_LOCAL_MACHINE) to add a value to the SOFTWARE registry key on the target machine.
Note You can expand the HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE nodes in the Registry editor and any other subtrees, keys, or subkeys with child keys or subkeys.
Highlight New in the context menu, and then select the type of value you are adding from the submenu. You can add these types of registry values:
Type of registry value (as listed in the submenu) Definition Sample data String value A fixed-length or variable-length text string A program name Binary value Binary data Hardware component data DWORD value Integer data represented by a number that is four bytes long Parameters for device drivers and services A new registry value is added to the selected registry key and shown in the Name column in the right pane of the Registry editor, with the default name New Value. You can change the default New Value name, if desired.
After adding a registry value, you must set it. For more information, see Setting Registry Values.
To rename registry values
Display the Registry editor.
In the left pane of the Registry editor, select the registry key or subkey containing the registry value you want to rename. (You may want to expand the Registry on Target Machine hierarchy to show the registry key or subkey.)
With its parent registry key or subkey selected, the registry value you want to rename is shown in the Name column in the right pane of the Registry editor.
Right-click the registry value you want to rename.
Select Rename from the context menu.
Enter the new registry value name.
To delete registry values
Display the Registry editor.
In the left pane of the Registry editor, select the registry key or subkey containing the registry value you want to delete. (You may want to expand the Registry on Target Machine hierarchy to show the registry key or subkey.)
With its parent registry key or subkey selected, the registry value you want to delete is shown in the Name column in the right pane of the Registry editor.
Right-click the registry value you want to delete.
Select Delete from the context menu.
The selected registry value is deleted from your installer project and is no longer shown in the Registry editor. The information will not be written to the target machine registry when your application is installed.