2

I'm an ASP.NET Web Forms developer who has recently switched over to an MVC web app.

I'm having difficulty working out the quickest way to preview code changes when running the MVC web app through the integrated Visual Studio web browser.

In web forms, I can make a change to the codebehind and simply refresh the page and it's all good.

In MVC, I seem to have to close the tab in the browser, return to Visual Studio and press F5, wait for it to build every single dependent project and open up a new tab in the browser to display the page. This is so much slower than how it works in Web Forms it's driving me to distraction.

Am I doing things right? Is there a way to speed this cycle up?

David
  • 15,750
  • 22
  • 90
  • 150
  • Does post from this page explain the same thing you are asking for http://forums.asp.net/t/1342521.aspx and then this as well http://stackoverflow.com/questions/702498/is-dynamic-compilation-in-a-asp-net-web-application-possible – Subhash Dike Apr 18 '11 at 10:13

2 Answers2

4

The view pages themselves are compiled dynamically and thus any changes to these can be viewed simply by saving the changes and refreshing the pages in the browser. Changes to code made elsewhere, however, will require a rebuilt after which you can refresh the page.

Pressing F5 will start the web server (if it isn't already started) and then attach a debugger to the process after which it will fire up the web page. The first two steps are very slow, and you should avoid them unless you specifically need to start the web server or debug the application.

So

  • Changes to view: ctrl+s -> refresh web page (f5)
  • Changes to code: ctrl+shift+b -> refresh web page (f5)
Kasper Holdum
  • 12,993
  • 6
  • 45
  • 74
1

I used to find setting my project to run via IIS, rather than Cassini, made it a bit quicker. If you've made changes to the code, you'll still have to compile the solution, but at least this way you aren't waiting for Visual Studio to slowly crank itself into gear every time.

Found this article that might provide some clues too:
What are the (dis)advantages of using Cassini instead of IIS?

Community
  • 1
  • 1
Daniel Hollinrake
  • 1,768
  • 2
  • 19
  • 39