views:

1042

answers:

5

I think it's associating my Web Service's CS files with the related ASMX files. But whatever's happening, I can't double-click to open the CS files - I have to "view Code" or it opens in the designer.

Anyone know how to turn off this automatic behavior? I just want to edit the code!

A: 

In the Solution Explorer view, click the "Show All Files" icon. This will put "+" symbol next to each of your files. Click the + and it will expand to show the .CS file which holds the ASMX's code. At this point, double click that file instead.

Stephen Wrighton
Thank you - but my web service CS and ASMX files are actually decoupled (CS are in a different folder and not bundled under ASMX as default) and when I click on those it still opens in designer :(
Steve Eisner
A: 

For some reason VS2005 seems to have this a bit backwards when it comes to webservices. To open a webservice in code view, double-click the .asmx file, not the .asmx.cs file.

I guess it makes a bit of sense, as there's nothing to "design" when it comes to a webservice, but it's counterintuitive if you've been working with .aspx files.

Aaron Cooper
Yep - it's exactly this backwards behavior that I'm hoping I can remove :( I hope that someone knows if it's possible...
Steve Eisner
+9  A: 

Try right-clicking, select "Open with...", mark "CSharp Editor" and select "Set as Default".

That works for avoiding the WinForms Designer.

Rasmus Faber
Awesome. Thanks!
Steve Eisner
+2  A: 

I found this question when trying to deal with a similar problem. I had a C# class in a file and whenever I double clicked on the file it would try to open in design mode but design mode was meaningless for this class. I just want to see the code.

I found that adding the [System.ComponentModel.DesignerCategory("")] attribute to my class fixed this. I wrote a few more details about it here The DesignerCategory attribte

Brian Ensink
A: 

In my experience, if you find that the wrote editor, that is the non-default editor, is opening when double-clicking on a file within the Solution Explorer then something is wrong with the underlying project's User Options file (.user) or the solution's User Options file (.suo). (I am not sure which, but I suspect the settings are stored in the .suo file.) Deleting the the .suo and all project .user files solved the problem.

I personally, set the Form Editor as my default editor for forms at the beginning of a project. After the forms are stable and require less user-interface design changes, I switch the default editor.

AMissico