New Web Project Model Option Coming for VS 2005
May 8th Update: The final release of the VS 2005 Web Application Project is now live. You can learn more about it here.
One of the things that we’ve been working on the last few months is a new web project model option for Visual Studio 2005 that we are tentatively calling “ASP.NET Web Projects”. Our plan is to have an initial preview web-download version of it available for people to install on top of VS 2005 sometime in the next few weeks.
The goal with this new project-option is to address some of the feedback we’ve heard from people who are finding migrating existing apps to the new web-site project model in VS 2005 more work than they’d like to-do (especially because of the new web site build semantics of compiling a web project into multiple assemblies). The new project-type will also help enable some scenarios that web-site projects don’t handle as well today (for example: around sub-web projects where the sub-project isn’t an app in the ASP.NET/IIS sense, but rather feeds its generated assembly to a parent app’s \bin directory to run). It also provides a model that will feel very familiar/identical for people who don’t want to change how they structure their web projects from VS 2003 today (for example: using a project file, etc).
This new option does not replace the web-site project option introduced in VS 2005, which provides a lot of new features and flexibility for web apps. Instead we see it as a companion project-type that you can optionally choose to use instead depending upon the specific requirements of your particular scenarios and your preferred development workflow. Some developers will find the web-site project model more natural/easy and choose that. Other developers will prefer a more explicit model and tighter control over their project and choose this new project model option. Rather than force people into one or the other approaches, we are going to support both workflows and allow developers to choose whichever web project model works best for them, their app scenarios, and their code-base.
Some technical information on the new project option
The new project model’s project, build, and compilation semantics will be pretty much the same as with the VS 2003 web project model. Specifically:
1) All code within the project will compile into a single assembly (that gets built and persisted in the \bin directory on each compile).
2) All files contained within the project are defined within a project file (as well as the assembly references and other project meta-data settings). Files under the web’s file-system root that are not defined in the project file will not be logically considered part of the web project. You will also now be able to define classes and types anywhere in the project structure (there is no longer a need to define them under app_code).
3) The compilation system uses a standard MSBuild based compilation process. This can be extended and customized using standard MSBuild extensibility rules.
Two of the big changes/improvements we are making over the VS 2003 model are:
1) We will not use/require FrontPage Server Extensions (FPSE) in order to open and edit these web projects. There also will not be any requirement to store your web projects under inetpub\wwwroot. Instead, you can just define a standard project file for your web project anywhere on disk and add/open/manage it directly (this also means no more .webinfo files and hard-coded http:// paths in the solution file). This should make organizing and managing your projects much easier.
2) We are adding the ability to optionally use the Cassini-based built-in web-server with these projects (alternatively you can obviously also use IIS). You will be able to create a new web project using this model, add a few pages, hit F5 to compile the code-behinds and other classes into a single assembly, and automatically launch Cassini to run and debug it. All of this will also work in a non-admin user account (so you can login to Windows and develop as a normal user).
The new model will fully support all of the new VS 2005 WYSIWYG designer changes (no more html reformatting, master page/theme designer support, etc), as well as all the improvements made in the html source editor.
Migrating VS 2003 Projects
One of the big reasons we are introducing this new project option is to help make upgrades from VS 2003 based web projects much easier. Because the compile-semantics between the VS 2003 and this new project model are identical (single assembly and project file based), developers should be able to upgrade their VS 2003 projects to this new project-type, do a clean compile, and have everything build without making code modifications or file-changes to their project (the file-layout and code structure stay exactly the same).
This will make it much easier to get started with ASP.NET 2.0 and migrate large code-bases quickly.
What about code already written for VS 2005?
One nice thing about the new project model is that it will also support easily moving individual pages back and forth between it and the built-in VS 2005 web site model.
The code authored in code-behind files can be the same – except that in this new project model the control field declarations are persisted and updated by the tool in an associated partial class file in the project instead of being generated automatically from the .aspx file itself at compile-time. The approach we are taking with the tool-generated partial class approach is similar to the way Windows Forms persists designer-generated code-spit in VS 2005 (inside an associated .designer.cs/vb file – so you don’t have to worry about the tool clobbering your code). The good news is that this means that from a developer perspective, you learn one way to author pages and their code-behinds -- and can easily use both web project model approaches with it.
What is different is that all code in your web project with this new project model is compiled together into a single assembly – so you can directly reference any classes or types in it. For example: a standalone class file could directly reference a page or user-control, like in VS2003 (note: this often isn’t a good practice – but now you will be able to-do it).
What is the release plan?
Our goal with the new project model option is to make it available quickly for people to take advantage of. It will be available as a free web-download that installs on top of VS 2005.
Our plan is to have an initial public preview available for people to download and start using in the next few weeks. This will be an early build that isn’t feature-complete. Specifically control field generation in the code-behind class and event-wire-up will need to be done manually in this first release (like you do today with VS 2003 if you don’t switch to design-mode to generate these fields/events) – although the core project system, build/compilation environment, debugging, and WYSIWYG page designer support will be there. We’ll then do refreshes of it as we finish fleshing it out and adding all features.
I’ll post more info about the download on my blog once it is available, but I wanted to give people a heads-up now about it coming.
Hope this helps,
Scott
P.S. Below is a screen-shot of what the new project option currently looks like (with a default.aspx based on a appmaster.master masterpage, and a standalone class all building into a single assembly):