Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The regular SharePoint solution development outputs mainly assemblies, which is deployed to GAC and used by other stuff (pages, webparts, controls, etc.). From googling I found that Release configuration includes c# code optimization and doesn't include debug metadata. So I considered that it is useful only on production with high-load parts. And it's acceptable only for stable code - could we connect to release-built assembly on production server with debugger?

So main question is: when to use Debug or Release and which benefits it can give?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

No, you can't connect Visual Studio to Release configuration code. The code is optimised and does not contain debug symbols, so you can't attach a debugger.

You can reconfigure the Release build to include debug symbols (and this doesn't really reduce performance), but the code is still optimised, so what it's running does not necessarily match what you see in Studio. It's quite funny - when I tried this the yellow 'current' line started highlighting spurious lines. It's not much good, so this configuration would make little sense.

However, the optimisation does make it faster. Those are pretty much the advantages and disadvantages.

Scott Hanselman goes into a bit more detail about this.

So the short answer is what you've said already. Use Debug during development, but Release when releasing stable code. Note that stable code probably should still have minor things like Logging built in.

share|improve this answer
add comment

MSDN has a couple notes on it: http://msdn.microsoft.com/en-us/library/wx0123s5.aspx

Basically you should use Release when you are building for your production environment. You can debug release code when attaching the debugger in Visual Studio. Debug builds are a bit more optimized specifically for debugging, but you can still step through release build code.

There are also some questions over on Stack Overflow that shed some additional details that you might be looking for:

http://stackoverflow.com/questions/90871/debug-vs-release-in-net http://stackoverflow.com/questions/933739/what-is-the-difference-between-release-and-debug-modes-in-visual-studio

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.