Visual Studio Hacks [Electronic resources]

Andrew Lockhart

نسخه متنی -صفحه : 172/ 58
نمايش فراداده

Hack 31. Save and Move Your IDE Settings

Move all your customizations from one computer to another with Visual Studio 2005.

Throughout this chapter, we have looked at numerous ways that you can customize Visual Studio to your needs, and in each section, we have looked at ways to move those customizations between machines, usually involving a power toy or manually copying a file to another system.

Visual Studio 2005 adds another way to move settings between machines by using a new import and export settings dialog. This dialog can be accessed by going to Tools Import/Export Settings. You will then see the screen shown in Figure 4-19.

Figure 4-19. Import/Export Settings dialog with Export selected

From this dialog, you can select the settings that you want to export from the tree view. The tree view list includes just about all of the settings that we have talked about in this chapter, including all of the settings in the Tool Options window. After you click Export Settings, Visual Studio will save a .vssettings file to the location of your choice.

The .vssettings file is a mixture of XML and binary data (the structure of the file is XML, but the value of some nodes is binary). Take a look at the file using any text editor, and you will notice that settings like key bindings are stored in binary and are not easily editable. Some of the other settings are stored as plain text and could be changed manually if you wanted to do so.

The .vssettings file can be copied to another system and then imported using this same window. You simply need to select the second radio button labeled "Import IDE settings from a file," and you will see the dialog shown in Figure 4-20.

Figure 4-20. Import/Export Settings dialog with Import selected

After selecting the file that you exported, you will see it listed on the left side; on the right side, you will be able to select what settings you would like to import from the file. After selecting the file to import from, as well as the settings to import, click the Import Settings button, and Visual Studio will then import all of these settings into the new installation of Visual Studio.

You can also restore Visual Studio to one of the default configurations. To do so, you first need to select the Reset IDE Settings option in the options group at the top of the window. You will then see the screen shown in Figure 4-21.

Figure 4-21. Import/Export Settings dialog with Reset selected

This screen displays the default Visual Studio configurations. You can select one of the configurations from the list and then click Reset Settings to restore all the Visual Studio settings to one of the default configurations.

This method of moving configuration settings is much preferred to the myriad of things you had to do manually with previous versions of Visual Studio, including copying files, using power toys, and backing up the registry.

A cool byproduct of this feature is the ability developers now have to easily share their Visual Studio configurations. If you want to show someone how you set up Visual Studio, you can simply send them your .vssettings file or even post it out on your blog for the entire world to check out (and ridicule you for using granny fonts or green type on a black background).