Open With... the editor of your choice.

I'm on an VS IDE high lately. So to continue in this arena. Here is another tip my students and audiences seem to like.

I'm sure there is someone out there who has an XML file with a non standard extension, and they want to be able to use the XML editor in Visual Studio. But when you open the file there is no colour coding or any of the other XML editor features. This is because you are not in the XML editor. This is a nice little trick, I hope someone finds it useful.

I found this the first time I set up a Visual Studio project to hold all my NANT Scripts. NANT creates XML files with a .build extension. When you edit these XML files in Visual Studio they are not colour coded by default, because Visual Studio does not know it's an XML file.

Here is how to rectify the situation. When you open the file in Visual Studio (File->Open->File...). You will notice a drop down arrow on the open button.


Click the drop down arrow and select Open With... You should get this dialog.


Select the type of editor you want to open the file with. While you are here click on the Set as Default button. From now on whenever you open a file with that extension it will be opened in the editor you selected. In my example files with a .build selection always open in the XML editor now.