ASP.NET 1.1 to 2.0 Conversion Continued
So far, I've identified three key issues with the upgrade process:
#1. Automatic Conversion Limitations - The automatic conversion seems to sporadically experience issues converting web pages and user controls that contain a namespace in the codeBehind definition. The strange errors I reported in my previous blog were completely caused by this issue. I found two key changes that needed to be made in the affected files:
The conversion automatically creates a new page or control declartion at the top of the markup code. The declaration looks something like this:
<%@ Page Language="vb" AutoEventWireup="false" Classname="myNameSpace.myPageName" CompileWith="myPageName.aspx.vb" %>
In certain situations, the conversion forgets to add the myNameSpace portion of the class name. This causes the IDE to be unable to link the page with the codeBehind, causing all sorts of confusion. If you see all sorts of strange compilor errors, including objects not being declared, look for this issue.
Another related issue is that VS.NET 2005 no longer needs the autogenerated code created by VS.NET 2003. In fact, if any auto-generated code exists, you end up with the same kinds of errors. It appears that the conversion process attempts to remove this code, but fails in many circumstances. You need to manually remove this section of code from each codebehind page:
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
I feel like this process is going to end up being fairly time-consuming in my case, as I have about 300 forms to fix. I'm dreading the fact that I may end up going through this process again when we are actually ready to switch over to ASP.NET 2.0...that is, if they don't fix the conversion process before then.
#2. ASP.NET 1.1 Page Paradigm vs. ASP.NET 2.0 Master Pages - Master pages are a great new tool available in ASP.NET 2.0, but it appears that the producers of VS.NET 2005 want to ensure you use them. In my current application, I've used user controls to mimic my own version of master pages. Every page in my application has the same format: (Which I apparently can't display, even using PRE tags)
myNamespace:myHTMLHeaderControl tag
form declartion
myNamespace:myPageHeaderControl tag
...content....
myNamespace:myFooterControl
form close tag
myNamespace:myHTMLFooterControl tag
Now, when I attempt to compile the application, every page complains with an error, rather than a warning, that the element form must be included within a parent element. I just went through a recent site overhaul, which led to the present master site layout. The recent overhaul occurred because I wanted to include a form element in every page header. The compilor complained unless the were in the same page. Now, the compilor seems to complain unless and
#1. Automatic Conversion Limitations - The automatic conversion seems to sporadically experience issues converting web pages and user controls that contain a namespace in the codeBehind definition. The strange errors I reported in my previous blog were completely caused by this issue. I found two key changes that needed to be made in the affected files:
The conversion automatically creates a new page or control declartion at the top of the markup code. The declaration looks something like this:
<%@ Page Language="vb" AutoEventWireup="false" Classname="myNameSpace.myPageName" CompileWith="myPageName.aspx.vb" %>
In certain situations, the conversion forgets to add the myNameSpace portion of the class name. This causes the IDE to be unable to link the page with the codeBehind, causing all sorts of confusion. If you see all sorts of strange compilor errors, including objects not being declared, look for this issue.
Another related issue is that VS.NET 2005 no longer needs the autogenerated code created by VS.NET 2003. In fact, if any auto-generated code exists, you end up with the same kinds of errors. It appears that the conversion process attempts to remove this code, but fails in many circumstances. You need to manually remove this section of code from each codebehind page:
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
I feel like this process is going to end up being fairly time-consuming in my case, as I have about 300 forms to fix. I'm dreading the fact that I may end up going through this process again when we are actually ready to switch over to ASP.NET 2.0...that is, if they don't fix the conversion process before then.
#2. ASP.NET 1.1 Page Paradigm vs. ASP.NET 2.0 Master Pages - Master pages are a great new tool available in ASP.NET 2.0, but it appears that the producers of VS.NET 2005 want to ensure you use them. In my current application, I've used user controls to mimic my own version of master pages. Every page in my application has the same format: (Which I apparently can't display, even using PRE tags)
myNamespace:myHTMLHeaderControl tag
form declartion
myNamespace:myPageHeaderControl tag
...content....
myNamespace:myFooterControl
form close tag
myNamespace:myHTMLFooterControl tag
Now, when I attempt to compile the application, every page complains with an error, rather than a warning, that the element form must be included within a parent element. I just went through a recent site overhaul, which led to the present master site layout. The recent overhaul occurred because I wanted to include a form element in every page header. The compilor complained unless the were in the same page. Now, the compilor seems to complain unless and
0 Comments:
Post a Comment
<< Home