Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does VS 2008's "Convert to Website" mean?

I have upgraded a MS Visual Studio Application from VS 2003 to VS 2008 (Targeting .NET 2.0). As part of the conversion process the wizard said I needed to take the additional step of Converting my Project to a Website by Right-Clicking and blah blah blah...

I didn't follow directions and the web application seems to be working fine.

My question is, should I be concerned about pushing this to a production system? What exactly is going on here?

like image 465
DrFloyd5 Avatar asked Sep 04 '08 01:09

DrFloyd5


2 Answers

There are two types of web applications in ASP.NET: The Web Site and Web Application Project. The difference between the two are discussed here:

Difference between web site and web applications in Visual Studio 2005

Convert to Website allows you to convert a Web Application Project to a Web Site.

Visual Studio 2003 used the Web Application Project style, but initially VS2005 only supported web sites. VS2005 SP1 brought back Web Applications.

If you don't want to convert your project to a web site, apply SP1 if you're using VS2005. VS2008 can support either.

like image 60
Jon Limjap Avatar answered Nov 23 '22 08:11

Jon Limjap


Convert to Website moves all of your control declarations from the main page class to a secondary file (yourpage.aspx.designer.cs).

It does this by using a partial class. That is, the same class for your page, but split into two seperate files.

This allows the VS2k5 (and VS2k8) designer to generate code for your pages without dumping generated code spaghetti into the main class file.

You don't need to do this step to build the project, but if you continue to maintain the project you will want too.

EDIT:

Hey look, MSDN backs me up:

To convert the code to use the partial-class model

  1. Make sure the code compiles without errors.
  2. In Solution Explorer, right-click the project name and click Convert to Web Application. This command iterates through each page and user control in the project. It moves all control declarations to a .designer.cs or designer.vb file. It also adds event handler declarations to the server-control markup in the .aspx and .ascx files.
  3. When the process has finished, check the Task List window to see whether any conversion errors are reported.
  4. If the Task List displays errors, right-click the relevant page in Solution Explorer and select View Code and View Code Gen File to examine the code and fix problems.
  5. Recompile the project to make sure that it compiles without errors.
like image 42
FlySwat Avatar answered Nov 23 '22 09:11

FlySwat