Sunday, June 1, 2008

Migrating an ASP.NET Web Site to a Web Application project

Migrating an ASP.NET web site to a web application project is a relatively simple process.

You can start off by installing Visual Studio 2005 SP1, if you're running VS2005, which is the preferred method or you can just install the extension to Visual Studio that adds the Web Application project support - This should be present by default in Visual Studio 2008.

Then, create the web application project in Visual Studio and copy across all the files from your Web Site project.

You will now probably notice that you have to convert all the CodeFile attributes to CodeBehind attributes and are missing the designer.cs file for all the pages and controls. You don't have to do any of this manually but rather have to use the IDE... Choose "Convert to Web Application" from the context menu of the web application project (in Solution Explorer). This causes Visual Studio to go through all your files, adding the designer.cs file and replacing the CodeFile attribute with the CodeBehind attribute (?).

It should be pretty much all that you need to complete the migration for the average ASP.NET web site project, but in case there's any more work needed, you ought to take a look at this article:
http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx

No comments: