Add Support for Nonstandard File Extensions

Add Support for Nonstandard File Extensions

Use the VSTweak power toy to tell Visual Studio how to handle file types that aren't supported by default.

Creating custom file extensions allows you to specify your own file extensions that will be treated like another already existing file type in Visual Studio. This is very useful if you have created a custom file type for your application but want Visual Studio to treat it like a regular file.

To create and manage custom file extensions, you can use a power toy called VSTweak. The VSTweak power toy is one of the more useful power toys for Visual Studio and is the subject of a number of different hacks in this book. The VSTweak power toy can be downloaded at

Once you have installed and launched VSTweak, click on the File Extensions Manager tab, shown in Figure.

File Extensions Manager

To add a new custom extension, you simply need to enter the custom extension in the Define Extension text box, select what kind of file this extension should be treated as in the Treat As drop-down, and then click the Add button shown in Figure. The extension .cxm will be added to Visual Studio and treated like an .xml file.

You can also remove custom extensions by selecting the extension from the drop-down and clicking the Delete button. Changes made to custom extensions are made for all users of your machine, not just you.

To edit custom file extensions, you must be logged in as administrator on your machine, or you must launch the VSTweak application by right-clicking on it and choosing Run As, then log in using an administrator account.

Managing custom file extensions is very useful, especially when creating custom file types or when hacking Visual Studio to do something it was never intended to do (such as adding the ability to edit .php files [Hack #12] ).

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows