SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

MSDN has a couple notes on it:

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:

share|improve this answer

Your Answer


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.