ASP.NET 2.0 Compilation - Again

There are a few ways of deploying a .NET 2.0 ASP.NET application

  • using Web Site Deployment Project
  • using VS.NET Publish Command
  • using VS.NET Build Command

1.) Using VS.NET Build

ASP.NET not Visual Studio performs the build.  ASP.NET builds everything, including .cs and .vb code files and places all resulting assemblies in folder structure under Temporary ASP.NET files directory.  As ASP.NET does all of the compilation, the debug setting in the compilation section of the web.config controls debug or release mode.  Compile with debug=true and you'll find the .pdb debugging symbol files alongside each assembly.  In this scenario the Configuration Manager is obsolete (not used) and as such the only option is 'Debug'.

 

2.) Using VS.NET Publish

This option is available when you are ready to publish to production.  The Publish command will precompile a web application and place the results into a director of your choosing (IIS/FTP/Directory).  Options are available on the Publish dialog box that map to aspnet_compiler switches.  The aspnet_compiler tool has option to create pdb files however this is not available on the dialog box (within vs.net).  Publish always builds in release mode without pdb files.  The Publish command does not change the debug setting in the web.config SO if you precompile and updateable (option 'allow this precompiled site to be updateable') web site and then update the web site in place (which will result in a dynamic compilation) those dynamic compilations will produce debug code and pdb files.

image

3.) Using Web Site Deployment Project (WSD)

This project allows VS.NET to use MSBUILD files provided by WSD to ask for debug and release builds.  This tool uses the aspnet_compiler similar to above with the Publish option however the WSD option will change the debug setting in the web.config to false for release builds (different than the Publish option)  By default the built files will be in respective debug or release directories.

 

Conclusion

VS.NET Build - builds web site to Temporary ASP.NET files directory with options specified in web.config

VS.NET Publish - builds to release mode (always) however does not change the compilation mode in web.config file (which can lead to less than optimum performance if site is dynamically recompiled)

Web Deployment Project - Builds based on Configuration Manager mode (debug/release) AND updates the web.config with additional options for creating debug symbols and swapping out web.config sections based on release mode

 

 

see related post http://blog.davidyardy.com/archive/2008/07/05/asp.net-2.0-compilation-models-again.aspx

Author

Admin

comments powered by Disqus

Categories

Recent Tweets

19 Types of Developers Explained dev.to/lpasqualis/19-…
Can't Afford Photoshop? Here Is The Best Free Drawing Software | Digital Trends digitaltrends.com/computing/best…
Retweeted by @dyardy Fun day christening Amazon’s latest wind farm. #RenewableEnergy https://t.co/cTxeXdsFop
Retweeted by @dyardy Hey C# peeps, we’re trying C# in browser with reference content. Try it here: docs.microsoft.com/dotnet/csharp/… reply with feedback /cc @LadyNaggaga
23 Amazing Vintage Photographs Taken Inside WWII Tank Factories ~ vintage everyday vintag.es/2017/10/23-ama…