When starting a new Web site project in Visual Studio 2010 one has the choice between creating a Web Application Project and creating a Web Site Project. These two different project types were introduced with Visual Studio 2005 and have stayed as options with the Visual Studio line. The differences between the two project types have a fairly important impact on how the project is maintained.
The primary difference between the two project types is that a Web Application project has a project file while a Web Site project does not. The project file acts as a file manifest so with a Web Site project one can dynamically add files outside of Visual Studio to the folder structure. This is nice for some projects and developers because individual pages can be updated without re-deploying the entire project. On the other hand, a Web Application project leans more towards code-behind and structured code releases since one needs to register any new file with Visual Studio so that it will be added to the file manifest.
At a more granular level, Web Application projects are compiled into an assembly in the bin folder. But with Web Site projects only code behind or controls are put into the bin folder assembly, and pages with inline code are compiled dynamically into separate assemblies.
This behavior difference between Web Site projects and Web Application projects leads to frequent debates between developers. I would say that Web Application projects are geared more towards Enterprise applications whereas Web Site projects are meant more for small dynamically changing sites.
Although the nature of Web Application projects may seem an annoyance at first, I think that the philosophy they encourage of deploying a Web as a tested unit is actually a huge benefit.
Web Application projects require the developer(s) to release a clean copy of the project as a tested unit whereas Web site projects do more to encourage piecemeal updates of Web sites. Although piecemeal site updates can be advantageous on smaller Web projects since this results in virtually no downtime, it also often results in site structures that are not consistent between production and development environments. As a site’s complexity and number of developers grows it becomes an advantage to update the site in scheduled release stages as a tested unit rather than in a haphazard manner.
I would suggest using a Web Site project for actively growing smaller sites with one or two active developers, and I would suggest using a Web Application project for a larger (Enterprise) site with more developers and possibly a structured release schedule.
- Web Site vs. Web Application Project – By Peter Lanoie
- ASP.NET: Web Site versus Web Application Project – By Agrace
- MSDN: Comparing Web Site Projects and Web Application Projects