Alright. I’ve relearned to do this by trawling the internet for the last time. Yesterday, I upgraded our development environment from Visual Studio 2008 to 2010. At the time it went swimmingly. Since then, I’ve been plagued with “little” issues like strange reference breakages in assemblies, and the bugbear that this post is about.
There are library files within the solution that contain things that “could” be built up with the VS Designer (sub-classes to DataTable are a perfect example but there are others). I don’t want or need the designer to step in and try doing its magic on them. It won’t anyway because they occupy the same file as a bunch of other support classes clustered around similar roles and unless a single designable class is at the top of the file, badness happens.
What I want is to get the file to open by default in the code editor instead of the design (GUI) editor that you get if VS notices one of these “designable” classes in a file. The fact that this has come back just after the upgrade makes me suspicious that certain settings were forgotten in the process.
So, first off, here’s a screenshot of a file I’ve just double-clicked on in the solution explorer, containing one of these designable classes, and the design “error” screen I get back:
So, when I hit this issue, I need to right-click on the offending file and choose the “Open With…” popup menu item thusly:
What I get is a dialog listing a number of editor types I can open the file with (below). Pay particular attention to the entry with “(Default)” after it. This is the one you’ll get if you double-click the file from the solution explorer.
On the right-hand side of this dialog is a “Set as Default” button. I choose the entry that I’d rather as the default, hit that button and whallah! Opening the file behaves the way I want by default. So, here’s a final screenshot where I’ve chosen the Visual Basic Editor instead of the Windows Form designer as my default editor.