views:

21

answers:

1

This is not technically a programming question but it does specifically relate to a heavily used programming tool so i think this is the correct place for it.

In Visual Studio 2008 if i have an asmx web service and i double click on the asmx file it opens the asmx.cs file, this is eminently sensible seens as there is just a single line directive in the actual asmx file. However if i click on the asmx.cs file directly, it tries to open it in "design" mode, i.e. the mode for aspx files where it shows you a visual designer rather than the markup. The result is you either get a grey screen saying that this file type cannot be viewed in design mode or you just get a wierd visual studio exception handling page. All i'm doing is double clicking on the asmx.cs page. I can post screen shots if anyone is interested. I have observed this behaviour on my coleagues machines as well so it does not seem to be some wierd quirk on my particular install. Has anyone observed this behaviour? can anyone reproduce it? Is it a bug? Is there a service pack that fixes it? Is it some wierd setting i have been unable to locate. It is not a show stopper becuase double clicking the asmx file opens the relevent code file but I would like to fix it if possible.

A: 

The .asmx file is essentially a markup file that points to a code-behind file. Since the markup is never changed, the (pre-VS2008) VS developers thought it was a good idea to display a warning screen instead.

To avoid this warning screen, you can right-click the .asmx file, select Open with... and set the Source Code (Text) editor Editor to be the default. In VS2008 and VS2010, the code-behind will display when you double-click the .asmx file in the future.

If you want to view and/or edit the markup of the .asmx file, simply right-click the .asmx file and choose 'View markup'. Not sure if this works in VS2008 (don't have it here), but it works in VS2010.

Prutswonder
It does not happen when i double click the asmx file, that opens the asmx.cs code file. It happens when I double click the asmx.cs code file, which is clearly not a markup file.
Ben Robinson
Added some instructions for you to open the markup file.
Prutswonder
Yeah, i don't want to open the asmx file i want to open the code file in the code editor when i double click on it, sorry if that wasn't clear. I will mark this as the answer because the instructions did work when I applied them to the correct file, the asmx.cs code file.
Ben Robinson