Click here to Skip to main content
15,066,066 members
Articles / Web Development / ASP.NET
Posted 28 Aug 2008


22 bookmarked

Migrating website projects to web applications in VS2008

Rate me:
Please Sign up or sign in to vote.
2.33/5 (3 votes)
28 Aug 2008CPOL3 min read
Step by step explanation to migrate website projects to web applications in VS2008.

Introduction and problem statement

I had created our website using VS2005. As you are aware, VS2005 handles website solutions a bit differently, since it doesn’t have project files for websites. Everything that is in the folder is included in the build/site, unless otherwise excluded.


The Web Application feature is now back in VS2008. This article will help you upgrade your website projects created in VS2005 to web application projects in VS2008. You might need this in order to get full benefit of the new features of VS2008 or you might be upgrading your site to the later versions of .NET (3.0 or higher).

You can have a look at the following articles that detail about the enhancements in VS2008:


I was searching upon some quick reference when upgrading things and this article is for those who want the steps to upgrading quickly.


As the title suggests, we are upgrading our website developed using VS2005 over .NET 2.0 to VS2008 while keeping the .NET version.

Before you begin

Make sure you have the latest code in hand and compiled without errors. Preferably make a new folder and copy the code to the new location.


Step 1: Upgrading website to VS2008

  • Launch 2008
  • Select File->Open->Web Site
  • Navigate to the newly created folder or the folder where the website code resides, select it, and then push the Open button
  • image001.jpg

  • You’ll be offered to upgrade the .NET version. For now, just click No to remain in version .NET 2.0.
  • image002.jpg

  • Compile and make sure that your website is running perfectly. You might need to set some references, for example, references to AJAX libraries.

Step 2: Changing a website project to a web application

The easiest way to migrate is to create a new solution/project and copy the site to it or add a new web application project to the one we created in the previous steps:

  • Launch VS2008
  • File->New->Project
  • Select ASP.NET Web Application from the dialog box


However, if you want to add a VS2008 Web Application project to an existing solution, right click on the solution node and select Add->New Project.

After the creation of the VS2008 Web Application project, remove the "default.aspx" and "web.config" files by deleting them; these files are added by the wizard by default. This is because you’ll be using your own files.

If you’ve created a new project, open the website in the same solution: File->Add->Existing Website.

Moving the files

Now with both the web application and the website open in Visual Studio, select all the files and folders in the website and drag and drop them to the web application. If the Data Source Configuration Wizard is launched during the process, cancel the dialog and allow the rest of the files to be dropped. Now add references to your newly created web application, and remove the website from the solution.


Idea behind conversion

The main difference in website projects and web applications is that website projects dynamically generate the tool-generated partial classes of a page, and do not persist them on disk. Web Applications on the other-hand do save these partial classes on disk within files that have a .designer.cs extension and compile them using the in-memory VS compilers when a build occurs.

The conversion

Now right click on the node in Solution Explorer and select Convert to Web Application.


You’ll notice the change in Solution Explorer:


The designer.cs files are added to the pages.

Where is my App_Code folder?

ASP.NET 2.0 dynamically compiles classes under the App_Code folder. Keeping your classes under this folder will get the classes compiled twice; resulting in a "could not load type" runtime exception -- caused because the type names are duplicated in the application. I recommend using the Classes folder to store your classes; however, the "Convert to Web Application" command would rename the folder to Old_App_Code.

Compile and Run

You’re almost finished, just compile and run the site to make sure that you’ve successfully migrated your website project to a web application project.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Muneeb R. Baig
Product Manager
Pakistan Pakistan
Having 20 years of experience developing innovative software targeting multiple industries including, EDA, Insurance, Supply Chain, Support Centers, CRM, Brain Storming (Mind Mapping); Muneeb is a developer turned project manager, who thinks he can still code and finds some time to keep himself abreast on latest trends and best practices—to implement them while managing the projects making the clients happy by ensuring timely deliverables of their expectations.

Comments and Discussions

GeneralMy vote of 5 Pin
gianerr19-Oct-10 23:08
Membergianerr19-Oct-10 23:08 
Generalmigrating to web site from web application Pin
syynapse10-Nov-09 3:58
Membersyynapse10-Nov-09 3:58 
GeneralRe: migrating to web site from web application Pin
Muneeb R. Baig11-Nov-09 17:47
MemberMuneeb R. Baig11-Nov-09 17:47 
GeneralRe: migrating to web site from web application Pin
syynapse12-Nov-09 5:01
Membersyynapse12-Nov-09 5:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.