Double-click the document in Solution Explorer -> Code View by default

Ok, this has been an annoyance for long enough.  I’m in Visual Studio.  I double-click on a web service’s code behind file in the Solution Explorer, and up pops an empty designer window.  I close the irrelevant window (once it finishes loading), right-click on the file, and choose “View Code”, then promptly kick myself for doing it again.

The solution comes from http://www.thescripts.com/forum/thread106933.html:

If you want to go to code mode by default, do the following:

1) Right click on the document name in the Solution Explorer

2) Choose “Open With”

3) Select “Csharp editor”

4) Choose “set as default”

I did this, and I’m golden – no more designer for web services.  Ok, I could still get to it if I right-clicked on the file name in the Solution Explorer, and chose “View Designer”, but when would I ever do that?  I can also put it back with this method just by choosing “Csharp form editor”.

Advantages: does it for all documents on my machine.

Disadvantages: doesn’t do it for anyone else, and I can’t do it per document, only per file extension (I think).

I recall in the crustaceans of my brain a way to do this via an attribute or pre-processor directive in the code file, but I can’t find it.

Rob