Share via


Setting 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:

  • Set registry values to specify the data written to the registry.

  • Set a default registry value which is a special case of adding and setting a registry value.

For information about adding registry values to an installer project, see Adding and Deleting Registry Values. For information about adding registry keys to an installer project, see Adding and Deleting Registry Keys.

To set registry values

Important   You must add a registry value to your installer project before you can set it. For information about adding registry values, see Adding and Deleting Registry Values.

  1. Display the Registry editor.

  2. In the left pane of the Registry editor, select the registry key or subkey containing the registry value you want to set. (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 set is listed in the Name column in the right pane of the Registry editor.

  3. In the Name column, select the registry value you want to set.

  4. Enter the value in the Value property in the Properties window.

    For information about working with registry properties, see Registry Properties.

To add and set a default registry value

Setting the default value for registry entries is a special case of setting registry values. Follow these steps to set a default registry value when you add the registry value to the installer project.

Note   For more information about adding registry values, see Adding and Deleting Registry Values.

  1. Display the Registry editor.

  2. In the Registry on Target Machine hierarchy, right-click the node representing the registry key or subkey where you want to add and set the default registry value.

  3. Highlight New in the context menu, and then select the type of value you are adding from the submenu.

    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 must change the default name, New Value, to establish the default registry value.

  4. With the default New Value name selected, press the BACKSPACE or DELETE key to erase and clear the value name (but do not delete the registry value itself).

  5. Press the ENTER key.

    (Default) is displayed as the registry value name. When you enter a blank registry value name, you establish the default registry value.

    Note   You can also establish a default registry value after creating the value, by renaming the value to a blank name. When you enter the blank name, it resolves to (Default), as in this procedure.