How to speed up ASP.NET web development?

Almost every ASP.NET developer heard or used ReSharper Visual Studio Addon or CodeRush from Devexpress. Those tools claim to speed up coding process up to 25%. However almost nobody realizes that most of the time asp.net web developer just waiting for project to compile. About a year ago I had to work on a big product. Compilation of whole solution usually took about 2-3 minutes. I felt like most of my work day I was just waiting for a project to compile. So, I came up with the following techniques.

1. "F5 Start Debugging" evil.

Never, never hit F5. This a slowest thing that you can do. First of all if it is possible use localhost IIS instead of Visual Studio built-in http server (aka Cassini). Better to test your project in a real environment. During my carrier I had a lot of situations when project worked in Cassini but didn't work in IIS and vice versa.

Compile your solution and open it in a browser. You don't need to hit F5. Just type http://localhost/YourApplication/Default.aspx and your test environment should be ready. You can make changes to your project. For codebehind changes you need to recompile project and then hit refresh in browser. For aspx changes, just save file and then hit refresh in browser.

For built-in web server you need to hit F5. It is a necessary step that can't be avoided, but do it just one time. Again another point for localhost IIS. Copy url something like http://localhost:1234/YourApplication/Default.aspx and paste it in new browser window. You can stop debugging now. You should still have one browser window open with your project in it. Cassini is still running, so you can do the same update process like for IIS. Below is a little screencast video of what I mentioned above. As an example I took my ColorPicker Control project.

Use following shortcuts: Ctrl-S (Save), Shift-F6 (Build Current Project), F6 (Build Solution). Very rarely build whole solution. Usually it is enough to build current project that you changed. If you need to debug application, use attach to process command. You can use following macros to automate this process:

Cassini:

    Public Sub AttachToFirstDevWebServer()

        Dim process As EnvDTE.Process

 

        For Each process In DTE.Debugger.LocalProcesses

            If (Path.GetFileName(process.Name).ToLower() = "webdev.webserver.exe") Then

                process.Attach()

                Exit Sub

            End If

        Next

 

        MsgBox("No ASP.NET Development Server found")

    End Sub

IIS:

    Sub AttachDebugger()

        Try

            Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger

            Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")

            Dim dbgeng(1) As EnvDTE80.Engine

            dbgeng(0) = trans.Engines.Item("Managed")

 

            Dim proc2 As EnvDTE80.Process2

            proc2 = dbg2.GetProcesses(trans, "").Item("w3wp.exe")           

            proc2.Attach2(dbgeng)

 

        Catch ex As System.Exception

            MsgBox(ex.Message)

        End Try

 

    End Sub

2. Multiple projects application structure.

Everybody heard about DAL and multiple tiers of application. However usually developers do not break application tiers into different projects. This is a really useful technique. Why do you need to recompile business logic layer for a small UI change? UI tier should be in its own project, so you can recompile only UI level and nothing else. Again just press Shift-F6.

4. Virtual hard drive.

Visual Studio is very chatty with hard drive, especially during compilation. If you are using laptop as your primary development machine then it probably has 5400 rpm hard drive. Microsoft suggests to use with Visual Studio 7200 rpm hard drives or even 10000 rpm hard drives. So, you might experience slowness. Virtual hard drive might help you. Copy you project to Virtual Hard Drive. Modify environment variables Temp and Tmp, so they point to Virtual Hard Drive as well. By using this technique I reduced my compilation time from 3 minutes to 45 seconds.

3. Firefox addons.

Use Firefox as you primary test browser. It has a lot of useful addons, which might help you with web development. Lately IE8 is catching up with Firefox, but it is still far behind.
1. Firebug
I can't imagine my life without firebug. You can do a lot of editing straight in firebug with live preview. Just copy paste a css code when you done tweaking it.
Take a look:

2. Web Developer addon
Has a lot of features, but I meanly use: clear cache, find broken images, resize window, view generated code, show passwords, display ruler, display guides.

3. ColorZilla Need quickly grab a color from web site? Want to rip off gradient? ColorZilla is your tool.

4. PixelPerfect If you are working closely with designers then you need this tool in order to make a perfect match of design and HTML.

5. XRefresh If you have two monitors this is absolutely need to have tool. It automatically refresh browser when you do change to a source code. It also has IE support.

6. IE Tab You need this addon if you need to test your web site in IE. Single click is going to switch rendering engines. You can set certain sites always use IE rendering engine, for example MOSS intranet sites.

7. YSlow You need this addon in order to optimize client side performance of your web site.

8. FireShot Screen shot tool with anotations.

kick it on DotNetKicks.com


Posted on Sunday, August 23, 2009 by | Comments (3) | Add Comment

Comments

Gravatar

Re:How to speed up ASP.NET web development?

This is a really good post. Thanks for the tips!

I personally hate using F5 to run a site. One of my coworkers will stop and start to make every change, even if it's just HTML or CSS! It drives me nuts!

I like to set up my local IIS with virtual directories pointed to all my project directories. If I ever need to debug, though, I do use F5, but maybe I'll try to start using Attach to Process instead.

I've never seen that Virtual Hard Drive before, I'm honestly going to try it out!

Posted on 8/26/2009 10:08:16 AM by John Varga #
Gravatar

Thanks for your comment. "F5 Coworkers" inspired me for this post. I glad that I am not alone :-).

Gravatar

Re:How to speed up ASP.NET web development?

i need solution...it's urgent...

Posted on 10/27/2009 12:41:24 AM by pavan #
Gravatar

Can you be more specific? What is your problem?

Gravatar

Re:How to speed up ASP.NET web development?

CTRL + F5 = start without debugging.

You can also add this to your toolbar: right click the toolbar area in VS -> Customize, then click "Debug" under Command tab, scroll down to "Start without debugging" (looks like an empty play button). Drag the icon to your toolbar, and click that every time.

Posted on 5/24/2010 1:39:38 PM by ma #
Gravatar

Nice hint, thank you.

New Comment

Your Name:
Email (for internal use only):
Comment:
 
Code above:

Categories

Valid HTML5