Labels

Monday, September 24, 2007

DLL/PDB file generation in ASP.Net

http://odetocode.com/Blogs/scott/archive/2005/11/15/2464.aspx

Debug and release builds are based on two things

§ .Net 1.x / .Net 2.0

§ Project Type [ Class Library / Web Site/ Web Service]

1.x

§ In 1.x, you can decide whether you need the build in ‘Debug’ or ‘Release’ mode by using the Build -> Configuration Manager menu option.

§ This works for all three type of projects viz. Class Library, Web Project and Web Service.

§ Class Library

o Debug Mode – bin\Debug\ClassLibrary1.dll and bin\Debug\ClassLibrary1.pdb

o Release Mode - bin\ Release \ClassLibrary1.dll [No .pdb is generated]

o

§ Web Project /Web Service

o Debug Mode – bin\Debug\ WebApplication1.dll and bin\Debug\ WebApplication1.dll.pdb

o Release Mode - bin\Debug\ WebApplication1.dll

M. Imp - Though the build in ‘Release’ mode can be decided thru Build -> Configuration Manager, however it is important to set debug=”false” along with ‘Release’ configuration in web.config to produce a true production ‘Release’ build in 1.x.

2.0

§ .Net 2.0 behaves almost different to the .Net 1.x approach.

§ For class library projects whether you need the build in ‘Debug’ or ‘Release’ mode is decided by using the Build -> Configuration Manager menu option. However .pdb files still gets created in the ‘Release’ mode as well.

§ But for Web Site/Web Services – Something different happens as below.

§ The most important concept to come to terms with in 2.0: Visual Studio 2005 knows nothing about compiling a web application and it delegates all compilation responsibilities to the ASP.NET platform.

§ When you ask Visual Studio to build a web project, nothing seems to happen. We don’t get the comforting feeling of having a bin directory with a .dll file inside. This is because ASP.NET performs the build and not Visual Studio.

§ ASP.NET builds everything, including .cs and .vb code files. Instead of creating ‘bin’ directlory with a .dll file inside, ASP.NET places all the resulting assemblies in a folder underneath the Temporary ASP.NET files directory [C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files].

§ Because ASP.NET does all of the compilation, the debug setting in the compilation section of web.config controls debug or release mode. Compile with debug=”true” and you’ll find the .pdb debugging symbol files alongside each assembly.

§ This new compilation model makes the Configuration Manager for a web site obsolete. The only option appearing in a Visual Studio 2005 web site “project” is a Debug configuration. Don’t fret – it means nothing. The web.config file now rules the school.

Class Library

o Debug Mode – bin\Debug\ClassLibrary1.dll and bin\Debug\ClassLibrary1.pdb

o Release Mode - bin\ Release \ClassLibrary1.dll and bin\ Release \ClassLibrary1.pdb [Yes .pdb is also generated in ‘Release’ Mode as well.]

§ Web Project /Web Service

o Debug Mode – Check Temporary ASP.NET files directory

o Release Mode – Check Temporary ASP.NET files directory

Summary

.Net 1.x –

§ For all types of projects - Build in ‘Debug/Release’ mode can be decided thru Build -> Configuration Manager.

.Net 2.0 –

§ For Class Library Projects - Build in ‘Debug/Release’ mode can be decided thru Build -> Configuration Manager

§ For WebSite/Web Services - Build in ‘Debug/Release’ mode can be decided thru Web.config.

Publish Web Site-

§ Publish will always precompile a Release build without debugging symbols.

§ The Publish command [Build -> Publish] does not change the debug setting in web.config. The Publish command always compiles for “Release”.

§ However, if you precompile to an updateable web site, and then update the web site in place (which results in dynamic compilations), those dynamic compilations will produce debug code and pdb files.

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment