Differences Between VS 2003 and VS 2005 Web Projects

Saturday, December 03, 2005 3:56:39 AM
Rate this Content 1 Votes

In VS.NET 2003 in order to open a Solution containing a Web project, you had to have a virtual directory in IIS mapped to the folder of the web app. You could work around this by using class library projects for web development instead of Web projects, though you still had to setup the virtual directory for it to actually work. I've used this approach in mojoPortal because it solved another problem where VS.NET 2003 Web projects do not work well with Subversion clients like TortoiseSVN because VS 2003 doesn't like the .svn folders in web projects. It works just fine with class library projects.
For deploying web projects in VS 2003 (whether they are configured as web projects or configured as class library projects) I'm a huge fan of the free VS.NET plugin UnLeash It, which makes it very easy to deploy just the files needed without the code behind source files. To prepare for deployment on a linux server using mono/apache, I would just choose Release mode then choose Rebuild Solution from the Build menu (this would avoid the default incremental build in VS.NET that doesn't work on mono).  Then I would right click the web folder and choose Deploy Project (a menu item added by Unleash It).

Building a Web project in VS 2003 would compile all the web code files into a single assembly and place it in the /bin folder beneath the root of the web source tree. The bin folder and its contents were not actually included as part of the VS 2003 Web project as far as VS 2003 was concerned. The actual files included in the project are determined by the .csproj file.

In VS 2005/ASP.NET 2.0, things are quite different, here are my observations:
 
It is no longer needed to configure an IIS virtual directory to open a solution with a web project. VS 2005 has a built in web server that it uses for debugging so if you hit the play button and start debugging it launches the app in the browser without the need of IIS. VS 2005 web projects don't mind the .svn folders and play nicely with Subversion clients like TortoiseSVN.

There are no such thing as project files like .csproj in VS 2005, everything in the web folder is considered part of the web project. This means that for example the bin folder if it exists below the web is part of the project.

If you Build a VS 2005 Solution with a web project and there are no other projects in the solution it will not even create a bin folder. If you have other projects in the solution like say a class library with business logic and a class library with data access code and you have references from your web project to them, it will create a bin folder and put the compiled business and data assemblies in there but you will not see the web code assemblies in the bin folder after building. Instead the compiled web code will be generated on the first request and stored in a temp folder beneath C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.

If you are not using an IIS Virtual directory but using the built in web server in VS 2005 you will also see some source files in the temp folder which are the partial classes containing control declarations and such. In fact you are not allowed to declare controls like TextBox, Label, etc in your code behind files. Doing so will result in errors when you try to build or run your web app because the runtime (and/or MSBuild I think) is in charge of generating partial class files containing the control declarations so adding them yourself will result in duplicate declarations. The above feature as far as I can tell is not yet implemented in mono. If you put the same source files that you used on windows in a virtual directory on linux/mono/apache configured to use the 2.0 runtime you will get errors because of the missing control declarations. If you add the control declarations to the source it will autocompile on mono and work just fine (at least the simple tests I have done work, not so sure about more complex things) but if you use that same source code on windows with IIS configured to use the 2.0 ASP.NET it will raise an error due to the duplicate control declarations. While in VS 2003 I could compile on Windows and deploy on linux/mono and it would work, compiling in VS 2005 and deploying on mono does not currently work. Since auto compilation of ASP.NET 2.0 source code does seem to work I suspect you could precompile from source on mono but I have not tried this yet.

VS 2005 has a feature to precompile your web app so you can deploy it without source code if you right click the web project and choose Publish Web Site. This will copy everything needed without the source files into a new folder tree outside the VS solution and will include the compiled web assemblies in the bin folder. When you do precompile the web project it does not all go into one assembly as it did in VS 2003, instead it goes into a number of assemblies some of which appear to be randomly named. You do have an option to make it compile a separate assembly for each page or control which is pretty nice because you can re-deploy part of a web project without re-deploying the whole thing. In VS 2003 it was a one shot deal since everything was in 1 assembly which could be a problem in cases where you had new features you were not ready to deploy but you wanted to fix a bug in an already released feature you could not deploy the fix without also deploying the new features. This problem is solved in VS 2005 because of the more granular assembly structure. You can get even more control over VS 2005 web project compilation and deployment using the new Web Deployment Projects which was not included in VS 2005 but is available as a beta at http://msdn.microsoft.com/asp.net/reference/infrastructure/wdp/default.aspx.

Update 12/15/2005: Scott Guthrie blogged about a new Web Project Model coming for VS 2005 that will make it possible to do things similar to what we did in VS 2003. For example we will have the option to compile the whole web into a single dll as before. It will use project files like VS 2003 so that only files listed in the .csproj file will be considered part of the project even if other files live on disk within the same folders. Most important we will have the option of making the partial class files with the control declarations live on disk as part of the project. In short, all the things I was worried about in terms of continuing to work with developers cross platform with MonoDevelop as I mentioned in my previous post will be fixed by the additional project model. Excellent!

Update 12/18/2005 Scott Guthrie has posted a link to a new site with more information on the new old way of doing things style Web Applications for VS 2005. You can even get a preview download with some of the functionality working. I'll be trying it out this week.

Copyright 2003-2010 Joe Audette
Share This Using Popular Bookmarking Services

re: Differences Between VS 2003 and VS 2005 Web Projects

Saturday, December 10, 2005 7:19:20 AM Tu?n Tr?n
Yes, what I've encounted with my very first web project in VS 2005 is that I could not find where the dll located. And when I found there were somethings new in the Temporary Net Framework folder, I did not know why the dll start with App_ ; I was so unhappy and thought about the back to 2003, to me, at that time, VS 2003 is more easier to control ~_*

However, follow some article from ScotGu of Microsoft and now, your article, I get more knowledge about the new things in 2005 version.

Thank you for guys like you, who willing to share knowledge to the rest of the programming world. Best wishes to your life and business

re: Differences Between VS 2003 and VS 2005 Web Projects

Saturday, December 10, 2005 7:49:48 AM Joe
Thank you!

It means a lot to get positive feedback, I appreciate it.

re: Differences Between VS 2003 and VS 2005 Web Projects

Friday, December 30, 2005 11:24:31 AM Joe Lynds
Hi, Joe--

Thanks for posting this...I too couldn't figure out what happened to the BIN directory...

-Joe

re: Differences Between VS 2003 and VS 2005 Web Projects

Tuesday, July 11, 2006 5:00:31 AM Prabu

good

re: Differences Between VS 2003 and VS 2005 Web Projects

Thursday, July 20, 2006 1:29:21 AM Priya
good article

re: Differences Between VS 2003 and VS 2005 Web Projects

Thursday, July 20, 2006 7:30:46 AM unknown

re: Differences Between VS 2003 and VS 2005 Web Projects

Wednesday, August 09, 2006 11:14:25 PM Rao Jahanzaib
Thank you for u r posting plz describe the features of vs.net 2005 considering the areas for programmers

re: Differences Between VS 2003 and VS 2005 Web Projects

Monday, September 11, 2006 10:52:28 PM Suresh Ramakrishnan
I could certainly understand the basic differences between vs2003 and vs2005 theoretically.I would request you to help us with a practical demonstration of the theory you have discussed.or If,available else where kindly help me with the same.(I mean the powerpoint slides indicating the steps involved in bringing out the differences between the versions.)---krishnansuresh2000@yahoo.co.in

re: Differences Between VS 2003 and VS 2005 Web Projects

Tuesday, September 12, 2006 4:30:22 AM Joe Audette
I don't know what you mean. I'm not putting forth a theory.

I only made observations based on my experiences and posted links that helped me with the transition from VS 2003 to VS 2005 for web development.

I posted this in hopes to help others making the same transition. I have nothing further to add. Sorry if this post did not help you.

Joe

re: Differences Between VS 2003 and VS 2005 Web Projects

Saturday, December 23, 2006 5:38:50 PM vadivel
thanks, this is very useful for me and who are all swith over the vs2003 to vs2005 very helpful this artical.

re: Differences Between VS 2003 and VS 2005 Web Projects

Monday, February 05, 2007 11:31:46 AM Chris
We just migrated from VS2K3 to 2K5 and I was pulling my hair out with the way it handles web projects.  I was seriously considering reverting back to 2K3 but after reading this I have some hope.  I haven't installed the new Web Project Model yet but it sounds like something I want to do.  Just wanted to thank you for the info and that even a year out, people still find it worthwhile.  Thanks!

re: Differences Between VS 2003 and VS 2005 Web Projects

Monday, February 05, 2007 11:41:47 AM Joe Audette
Hi Chris,

You don't need to install the Web Application Project type anymore. Just upgrade to VS 2005 SP1 and its included.

Cheers,

Joe

re: Differences Between VS 2003 and VS 2005 Web Projects

Wednesday, February 21, 2007 11:26:36 PM rajendran

hai,

sorry, I dont know what you mean....

Plz explain legibly....Thank you

re: Differences Between VS 2003 and VS 2005 Web Projects

Wednesday, March 28, 2007 4:13:11 AM ramakishore

i am very exiting to see this article. it's so helpfull to me as well as to all the programmers.

thank you for giving this type of articles. i want more articles.

regards

Ramakishore

re: Differences Between VS 2003 and VS 2005 Web Projects

Saturday, May 05, 2007 6:12:33 AM unknown

re: Differences Between VS 2003 and VS 2005 Web Projects

Saturday, May 05, 2007 6:21:59 AM seraphine Rosario

This article was very useful for me,.............

re: Differences Between VS 2003 and VS 2005 Web Projects

Saturday, May 05, 2007 6:22:01 AM seraphine Rosario

This article was very useful for me,.............

Comments are closed on this post.
Donate Money to support the mojoPortal Project. View Joe Audette's profile on LinkedIn View Joe Audette's profile on The Guild of Accessible Web Designers site