Differences between Web Site Project and Web Application Project

I have been working on both kinds of web projects since I started developing on ASP.Net. After manually migrating a Web Site into a Web Application Project, I now understand the differences:

Topic Web Site Web Application
Project Files All files in and below the project directory All files added to the .csproj project file
MasterPage Reference Add “Web Form” and check “Select master page” Add “Web Content Form”
Assembly Namespace Global namespace Namespace as defined in project
Generated assemblies Code in the App_Code directory compiles into a single assembly. Code from code-behind files compile into various assemblies named App_Web_*.dll. Assemblies can be merged using aspnet_merge. Compiles into single assembly
Code Restrictions Since code-behind is generated into randomly named assemblies, code in one page or control almost certainly cannot reference any other page or control. (Work-around: extract to base class or interface inside App_Code) Code under the App_Code directory is ignored. (Solution: rename App_Code directory)
Complete build Build from command line using aspnet_compiler Add aspnet_compiler as Post-build Event
Publish Publish from command line using aspnet_compiler and aspnet_merge Publish from command line using msbuild /property:OutDir=(path)
Published files Contents of aspx and ashx files is replaced by the text “This is a marker file generated by the precompilation tool, and should not be deleted!”. The Bin directory contains a (filename).(8hexdigits).compiled file for each compiled markup file listing the original dependencies. Original aspx, ascx, master files remain. ashx files refer to their implementation class.
About these ads

4 Responses to Differences between Web Site Project and Web Application Project

  1. [...] I have written about the functionality of Web Deployment Projects for Visual Studio 2005, and after upgrading also downloaded Web Deployment Projects for Visual Studio 2008. Not much has changed in the meantime, but there are some noteworthy differences between Web Site Projects and Web Application Projects. [...]

  2. tsahi says:

    Re: Published files, this is not accurate. You certainly can have the source .aspx files in a Web Site project in deployment. This is configurable in the Publish Web Site dialog (“Allow this precompiled site to be updateable”).

  3. [...] I recently migrated an ASP.Net Web Site Project to a Web Application Project, I also tried to “clean up” the markup files [...]

  4. [...] module tests for each piece of functionality (especially if you chose to develop ASP.Net web sites rather than web [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 72 other followers

%d bloggers like this: