views:

26

answers:

2

I am building a web application. Here's what I do.

Set the solution Configuration Manager to Release. Thus all projects are building the Release version. Then I clean the solution and build all. Then I "Build Deployment Package".

When running the installed code from the deployment package I notice when there is a bug in the compiled source the source file appears! How is this possible, I am building the Release configuration. The source code is definitely not in the release so it must be in the dlls.

Is there a way to stop this?

+2  A: 

Assuming you are talking about the 'Yellow Screen of Death' ASP.NET error pages, showing the source code locations of the exceptions; that is happening due to including the debug symbols in the build and the deployment package. That is the *.pdb file(s) named the same as your *.dll file(s).

This is not bad, in and of itself. However, you should not be displaying those errors to end-users regardless. Even without the debug symbols, those error messages show too much information. You should be handling errors and displaying a 'safe and friendly' error message to users.

If you want to remove the debug symbols, you can remove the PDB files. You can also change the build properties in the project, and remove the option that includes debug symbols.

Andrew Barber
+1 for suggestion to display friendly (or alternate) error pages. The real exception should be logged to disk or another source using logging features like nLog or Enterprise Library Logging Application Block, etc.
John K
+1  A: 

In addition to Andrew's answer you should also check that your web.config has debug disabled:

<compilation debug="false"/>

That should prevent the source code from showing in the 'Yellow Screen of Death'.

Marnix van Valen
+1 for must-have advice, too. I'm not *100% sure* though, but I think that since this affects only the Page/Control source compilation, and not the pre-compiled DLLs, that this might not affect the display of the debug symbols from the PDB files.
Andrew Barber
@Andrew Barber : The .PDB file only points to the source file and line number, it doesn't contain the actual source code. Only if both the .PDB and the source code is available, like on a development system, the source will be shown, regardless of the debug setting.
Marnix van Valen