Visual Studio Tip: Import a *.reg file

Screenshot of Visual Studio IDE showing the Registry Import menu item

Here is a handy feature of Visual Studio which took me a while to discover when I started using the tool.

As part of packaging up an application it is common to store configuration settings within the registry. While using a Smart Device CAB project you can use the convenient Registry view to set up these values graphically.

The feature that I didn’t notice for a while is the fact that you can right click on the window to get an Import… menu item (as shown in the screenshot above). This enables you to import a group of settings from a *.reg file, which saves you manually entering them all via the IDE.

So how do you create a *.reg file? One way is to manually write one in a text editor. Another is to generate it via the Windows CE Remote Registry Editor utility. Once you have configured your device you can use this tool to export a specific sub-tree of the device’s registry as a *.reg file that you can then import directly into Visual Studio.

Screenshot of Windows CE Remote Registry Editor utility showing the Export Registry File menu option

One Response to “Visual Studio Tip: Import a *.reg file”

  1. If you need to edit or manually create a *.reg file you can refer to the Microsoft Help and Support article “How to add, modify, or delete registry subkeys and values by using a registration entries (.reg) file” available at http://support.microsoft.com/kb/310516.

    Although this article is specific to the desktop a number of the key details are the same for Smart Device development. Just replace use of the regedit utility with the Windows CE Remote Registry Editor discussed above.

Leave a Reply