views:

113

answers:

2

Hi --

This may be a stupid question, but I'll feel stupider if I don't ask and find out in 12 months that it was possible (this happened when I realized I could do what I'm requesting below with .aspx files).

Is it possible to change my project files (c# classes, which predominate in an asp.net mvc environment) without recompiling whilst debugging? Specifically, if I find a bug while stepping through code, I want to avoid stopping the debugging, then restarting, and all the associated waiting.

Thanks, James

+1  A: 

Yes. Set breakpoints around where you want to change the code. Also, you must for each project go to Project -> [Project Name] Properties, click on the Web tab ... under servers check Enable Edit and Continue. You will only be able to do this if you're using the Visual Studio Dev Server (which you should always do in my opinion). If you find that problematic to deploy than just downloda the Web Deployment Project add-on.

http://www.microsoft.com/downloads/details.aspx?FamilyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&displaylang=en

Regards.

Nissan Fan
I thought I should mention that for C# this is required ... for some reason VB.NET users get Edit and Continue by default.
Nissan Fan
I'm using VWD Express, so it seems that your answer won't work for me; this is probably the most compelling upgrade reason I've seen yet.
James S
You can do it:http://blogs.msdn.com/webdevelopertips/archive/2008/11/26/tip-29-did-you-know-how-to-enable-edit-and-continue-feature-for-web-application-projects.aspx
Nissan Fan
You're right. I missed it... as soon as I saw NTLM, I assumed the next option was another auth method. Then I read the add-on link you posted which doesn't list Express as a supported edition. Guess I don't need to buy a copy of VS! Thanks.
James S
+1  A: 

You can do this to a limited degree, it's called "Edit and Continue". You're allowed to modify values of variables, and move the "current line" arrow indicator to some other line to immediately jump/skip to that code.

Here's a blog post showing how to enable that.

What you can't do is full scale editing - changing methods, adding properties or basically changing the way your class would be compiling.

Note that you can also use the Immediate Window to execute arbitrary code while debugging. This can be a great way to play around with changing your variable values and executing functions that exist in your code.

womp