Web Application Projects versus Web Site Projects in Visual Studio

In Visual Studio you can create web application projects or web site projects. You create or open a web application project by choosing New Project or Open Project in the Visual Studio File menu. You create or open a web site project by choosing New Web Site or Open Web Site in the File menu.
Each type of project has advantages and disadvantages, and it is helpful to understand the differences between them in order to select the best project type for your needs. You must select the appropriate project type before you create a project, because it is not practical to convert from one project type to the other.

For some scenarios, you do not have a choice. For example, if you want to create an
ASP.NET MVC application, you must use a web application project.

Scenarios in which web application projects are the preferred choice include the following:
  • You want to be able to use the Edit and Continue feature of the Visual Studio debugger.
  • You want to run unit tests on code that is in the class files that are associated with ASP.NET pages.
  • You want to refer to the classes that are associated with pages and user controls from standalone classes.
  • You want to establish project dependencies between multiple web projects.
  • You want the compiler to create a single assembly for the entire site.
  • You want control over the assembly name and version number that is generated for the site.
  • You want to use MSBuild or Team Build to compile the project. For example, you might want to add prebuild and postbuild steps.
  • You want to avoid putting source code on a production server.

Scenarios in which Web site projects are the preferred choice include the following:

  • You want to include both C# and Visual Basic code in a single web project. (By default, a web application is compiled based on language settings in the project file. Exceptions can be made, but it is relatively difficult.)
  • You want to open the production site in Visual Studio and update it in real time by using FTP.
  • You do not want to have to explicitly compile the project in order to deploy it.
  • If you do precompile the site, you want the compiler to create multiple assemblies for the site, which can include one assembly per page or user control, or one or more assemblies per folder.
  • You want to be able to update individual files in production by just copying new versions to the production server, or by editing the files directly on the production server.
  • If you precompile the site, you want to be able to update individual ASP.NET web pages (.aspx files) without having to recompile the entire site.
  • You like to keep your source code on the production server because it can serve as an additional backup copy.

    MSDN: Web Application Projects versus Web Site Projects in Visual Studio

Advertisements

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