views:

248

answers:

4

In an ASP.NET Web Site project, I've always been able to make changes to the underlying C# code and simply refresh the page in the browser and my changes would be there instantly.

I can do the same thing when working with Java and Eclipse - edit my Java source and refresh the page and my changes are there.

I cannot do this in ASP.NET MVC though and it is a real downer - I have to stop the running process and make my changes, and then restart debugging. This is a huge waste of time.

Am I doing it wrong? What is the best approach to ASP.NET MVC development?

A: 

The fastest way to code is to Host locally on IIS and then all you have to do is build the solution before checking out your changes.

Another alternative is chucking everything into the App_Code folder which will compile on the fly as you make changes.

jfar
Is this technically incorrect?
jfar
A: 

You don't have to stop the process, you can break.

Try breaking the project, then editing, then continue.

1) CTRL-ALT-BREAK 2) Edit your code 3) F5

mrjoltcola
+1  A: 

Visual Studio locks the source code in debbug mode. So your options are: 1. Publish the site on your local IIS and use the "attach to proccess". 2. Use Run without Debugg (Ctrl-F5) insted and again "attach to proccess". 3. Brake the execution in debbug mode (with Breakpoint).

the first one is my favorite

tsinik
+2  A: 

I rarely use debug mode in ASP.NET MVC project (F5). I run the project once with CTRL+F5 and always have a browser window open. Then if I make a change to a view (.aspx, .ascx), I hit F5 in the browser and changes automatically take effect. If I have to do changes in the .NET code (controller logic, models, repositories, etc...) I no longer use the browser. To verify that my change is correct I navigate to the corresponding unit test and hit CTRL+R+T. The result is seen either in green or red.

Darin Dimitrov
This is one of the huge benefits of MVC. Why fire up the debugger when building, your tests should cover a majority of your logic. Same with webforms MVP. Save yourself a TON of time and start writing good tests.
Chad Ruppert