Wednesday 20 June 2012

Web Site project vs Web Application project


How does a Web Site project differ from a Web Application project:

A common question by asp.net developers is what project model to use for an asp.net application? Web Site project (which was introduced in VS 2005) or Web Application project (which was delivered as an add-in for VS 2005 and built-in to VS 2005 SP1).


The main differences between 2 of them are as follows.

Web Application project model:

  • Provides the same Web project semantics as Visual Studio .NET 2003 Web projects.
  • Has a project file (structure based on project files).
  • Build model - all code in the project is compiled into a single assembly.
  • Supports both IIS and the built-in ASP.NET Development Server.
  • Supports all the features of Visual Studio 2005 (refactoring, generics, etc.) and of ASP.NET 2.0 (master pages, membership and login, site navigation, themes, etc).
  • Using FrontPage Server Extensions (FPSE) are no longer a requirement.



Web Site project model:

  • No project file (Based on file system).
  • New compilation model.  
  • Dynamic compilation and working on pages without building entire site on each page view.
  • Supports both IIS and the built-in ASP.NET Development Server.
  • Each page has it's own assembly.
  • Defferent code model.  (Read here for more details)
  • Ok, all is great, but you want to create your web site now. Which model should you use?



If you:
  • need to migrate large Visual Studio .NET 2003 applications to VS 2005: use the Web Application project.

  • need to add pre-build and post-build steps during compilation :  use Web Application project.

  • need to build a Web application using multiple Web projects :  use Web Application project.

  • want to generate one assembly for each page :  use Web Site project.

  • want to open and edit any directory as a Web project without creating a project file :  use Web Site project.

  • prefer dynamic compilation and working on pages without building entire site on each page view :  use Web Site project.

  • prefer single-page code model to code-behind model :  use Web Site project.

see: blogs.msdn.com
also: blogspot.co.uk

2 comments:

  1. Great Blog dear! This particular post makes a good reference for selecting the correct project option in VS.
    Hire .NET Developer

    ReplyDelete
  2. Thanks, Andrew. I'm very pleased you like the post (and the blog)!

    ReplyDelete