Large/Small Solution Conversion of .ASPX forms to Whidbey, Version2, VS2005;
Manually or Automatically,
Author: Terry Voss

          1) You may want to convert a few pages, so read below, (to manually convert a page takes about 1 minute)
          OR

          2) you may want to convert 300 projects, so download this simple version2 .ASPX page: convert35.zip (to auto-convert 35 .ASPX pages takes about 1 second)

Recently due to a Microsoft Ascend program, a client decided to convert their project to Visual Studio 2005 now versus waiting for a later upgrade version. They need advertising to get funding and to get more subscribers for their web site when the project is finished about summer 2005.

I am not hereby trying to convince developers or anyone that Visual Studio 2005 is currently stable enough to convert to now! There are many more builds going to take place before the retail version is available. The ASP.NET Team is currently working to solve upgrade and make it seamless.

Actuall y the auto-conversion worked on a smaller project, but just wouldn't do this 1,000 file database project with 180 aspx files. Also what if your project converts, but later you find a particular aspx file that didn't get converted. I could not find a way to tell the auto-convert to act just on that one file. So if there was an easy way to do this it would be great.

Conversion Steps for VS 2005:

aspx file(the frontend):

1) replace codebehind with compilewith
Which tells this class where to find its other half
2) replace inherits with classname
And this tells this class which class in the compileswith file to compile with.

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="adl.aspx.vb" Inherits="tic.adlpage" smartNavigation="False" %>


becomes

<%@ Page Language="vb" AutoEventWireup="false" Codebeside="adl.aspx.vb" Classname="tic.adlpage" smartNavigation="False" %>



3) Delete any references to positionlayout=gridlayout in the body tag as it is no longer supported. Flowlayout is the way to go now inside panels.

4) if design view won't come up, then fix all can't switch errors
(to do this use the task window's errors to look for the "Can't switch" errors and double click them to get to the problem and you will find that basically they are all html tags illegal overlapping like <P><asp:panel></P> type so they are easy to fix.)

aspx.vb file(the codebeside assuming you are using such as I always do):

1) add namespace tic ... end namespace
If it is not already there around the partial page class. This is no longer part of the project properties or built in.

2) replace public class with partial class and delete the inherits statement.
The codebeside is now beside not behind as the partial class keywords make the class part of the class that the html begins with. This is why the html must be valid now in the sense that you cannot have overlapping tags as above example. Now also, if Microsoft makes any of their source classes partial we can extend those classes versus just subclassing them by using the same class name with partial and adding methods and properties. Notice that we are not inheriting from a page, because codebeside is a part of a unique class in the front end and we have the masterpage to use to do part of what inhertitance did in the past. Of course you could still inherit.

Public Class testpage : Inherits System.Web.UI.Page

becomes

Partial Class testpage



3) delete all "private with events controlname as system.web.ui.webcontrols.textbox" statements
As with partial classes all references are shared, so redeclaring an object would be declaring twice.

4) If there are 0 errors in the Task panne then you will have no problem saving and running with this conversion. If there are any errors showing up fix them. Understand that sometimes an error won't show as fixed in errors even though you have successfully fixed the error. So when compile errors show up try continue YES vs the usual no to see if it runs your start page.

You are done now with that page's conversion and yes one minute is easy on a simple page, complex ones take 2 minutes. :)

Good luck and send your questions to: tvoss@computer-consulting.com