About the author

Steven HarmanSteven Harman is a passionate developer who believes that writing great software isn't just a job, its a craft.

ASP.NET MVP

For recent posts and more about me, scroll to the bottom.

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

Jobs

Badges

  • Subtext Project
  • Support Subtext
  • HiddenNetwork.com Banner

Migrating a VS 2003 Web Project to VS 2005 Web Application Project - Gotcha!

I recently tasked myself with upgrading a (work) project from the Microsoft .NET Framework version 1.1 to the much improved 2.0 version. One of the biggest (and best) side effects of  upgrading to the 2.0 framework is getting to develop the project in the Visual Studio 2005 IDE - which is a huge improvement over the 2003 edition.

 The project I was upgrading was known as a Web Project (in VS 2003 terms) and I wanted to upgrade it to a VS 2005 Web Application Project. Prior to VS 2005 SP1 the default web project model was the Web Site Project and using a WAP model in VS 2005 required a separate download. However, with SP1 support for the WAP model is built in. [Read more about the various project models here.]

Do your homework

Homework time! Since this was my first attempt at upgrading a project from VS 2003 to VS 2005, I made sure to do my homework before starting. I found a great resource via Scott Guthrie's site that walks you through the migration process.

Based on what I read I was under the impression that migrating a VS 2003 Web Project to VS 2005 SP1 would automagically upgrade the project to the WAP model. However, if you use FrontPage Server Extensions to access your project on a remote server, you must remove the FrontPage bindings prior to upgrading or your project will be upgraded to the VS 2005 Web Site Project Model. Read that last sentence again.

See Scott's article (linked to above) for instructions on how to remove the FrontPage extensions prior to upgrading your project.

As far as I knew, the project I was dealing with did NOT make use of the FrontPage extensions, so I should be good to go. But I was not so lucky. After my first (and second... and third) attempt to migrate the project to VS 2005 (and the WAP model) it kept converting to the Web Site Project Model.

WTF? Where is the WAP?

I don't know exactly why my first several attempts to migrate the project caused the project to be upgraded to the Web Site model and not the WAP model, but I do have some ideas.

This project (like all work projects) lives in source control... Subversion in our case. So before I started down the migration road I checked out a clean copy of the code from our SVN repository and saved it right next to my regular code check out on my local machine. I saved the clean check out to the C:\projects\myProject_clean\ directory. We'll call this location the CleanCopy. This was right next to my other check out (C:\projects\myProject\), which we'll call OrigCopy.

Since this was a VS 2003 Web Project, the VS solution file (and the myProj.webinfo file) has a reference to the web location for the project. The location might be something like:

http://localhost/SteveProject/myProj.csproj

The directory "SteveProject" is a virtual directory inside the IIS web site on my local (Windows XP Pro) development machine... so your virtual directory will be different. The file named "myProj.csproj" is the actual C# project file for the VS 2003 Web Project.

Virtual directories are really just pointers to a real directory that lives at some other location (on your machine, network, etc...). In my case, the virtual directory mentioned above was pointing to the location of my real code check out, OrigCopy. However I was trying to migrate the copy of the code that lived in the CleanCopy location.

This is a problem! The migration process was looking at the VS solution file from the CleanCopy, but was trying to upgrade the OrigCopy. Somehow this resulted in the migrating my project to the VS 2005 Web Site Project Model.

Fix the virtual directory

After I tweaked my virtual directory to point to the right location (that is, point it at the CleanCopy) I tried the upgrade one more time.

Success! This time it worked.

How do I know it worked?

VS 2005 - Convert to Web Application In the VS 2005 Solution Explorer, right-click on the project that used to be a Web Project (in VS 2003) and you should see an option to Convert to Web Application. You'll need to click that so VS can

recursively examine every page, user-control, and master-page in the project and automatically generate a .designer.vb file for each, as well as change the .aspx/.ascx files to use the "codebehind" rather than the "codefile" attribute.

For more information on converting the files, see Scott's guide to migrating from the VS 2005 Web Site Project to the WAP model.

I still had several changes to make to the code to get it to compile and run under the .NET 2.0 Framework, but at least the project was following the correct model.

I hope this will help you avoid the same hair-pulling, head-bashing frustrations that I had to endure. Good luck!

What others are saying.

# re: Migrating a VS 2003 Web Project to VS 2005 Web Application Project - Gotcha!
Gravatar John Rummell
Jan 15, 2007
I've been wondering about this process myself, as I have 4 VS 2003 web projects to convert to 2005 WAP. Thanks for the information!
# re: Migrating a VS 2003 Web Project to VS 2005 Web Application Project - Gotcha!
Gravatar Steve Harman
Jan 16, 2007
Hey John, good luck with your conversions... hopefully you don't run up against any show stoppers!
# Visual Studio: The Output Window, External Tools, and a Gremlin
Gravatar StevenHarman.net
Jul 12, 2007
Visual Studio: The Output Window, External Tools, and a Gremlin
# re: Migrating a VS 2003 Web Project to VS 2005 Web Application Project - Gotcha!
Hi John, Good article you have put there.

However, my problem is that I need to change the virtual directory name too and do not want to use the same virtual directory for my new project (converted one).

What are possible solutions? Would changing the solution file and web info file with the "changed" virtual directory address directly in notepad have any affect?

Waiting for your respond.
# re: Migrating a VS 2003 Web Project to VS 2005 Web Application Project - Gotcha!
Gravatar Prashanth
Jan 28, 2008
Thanks a million for writing this up. I struggled several hours today with the same problem. Then I came across this article and resolve the problem.

In my case, I setup the virtual directory to point to the 'CleanCopy' and also removed the .webinfo file from my Web Project in the 'CleanCopy' folder.
Comments have been closed on this topic.