views:

808

answers:

2

Hi all,

This may be a stupid question, but it's something that bugs me on a regular basis, so no harm in asking here I guess.

What exactly is Visual Studio doing when I open up an .ASPX file and it takes a good 4-5 seconds longer than if I was just opening the code behind file (.ASPX.CS).

I've noticed this happening with VS 2003, 2005 and 2008, and on a newly built machine too, so it's not an issue of my dev machine being too slow.

It seems to only happen when opening any .ASPX file for the first time in a particular session though. Is there some processing going on that I can disable to get rid of this delay?

Cheers

+10  A: 

Because Visual Studio has to process the aspx files to represent them in design view. Source files do not have a design view.

It probably caches what it needs for design view. This will make things faster the next time it wants to load the file.

Mehrdad Afshari
Is there a way to disable Design view? I never use it anyway, I always open the files in "Source" view.
C.McAtackney
I don't know about a way to disable it altogether, but you can set the default to source view in Tools->Options->HTML Designer
Mehrdad Afshari
You can map particular file extensions to particular editors in the File Extensions options. As an example, I always map .xaml files to the regular XML Editor for the same reasons - the designer is painfully slow.
Kent Boogaart
@Kent: Nice. I was thinking of the same thing but I hadn't tried it. Thanks for sharing it.
Mehrdad Afshari
Thanks Kent, that's exactly what I was looking for. I've mapped my .resx and .aspx files onto the XML editor now. I lose some syntax highlighting for the ASP stuff in there, but that's more than acceptable compared to the speed increase I've got now. Cheers!
C.McAtackney
+2  A: 

To speed up VS opening .aspx files, you can right-click on them and choose View Markup, which will take you directly to the HTML without it opening the design view.

Of course as soon as you try to switch to design view again it'll take a couple seconds to load the page up.

weiran