Saturday, March 2, 2013

Upgrading- Updating- Migrating ASP.Net 2.0 to ASP.Net 4.0


Today I upgraded our ASP.Net 2.0 project from Visual Studio 2008 to Visual Studio 2010 targeting .Net 4.0.
I ran into some issues and just wanted to list them here so others might be forewarned.
  1. Our solution has 5 web applications and many other class library projects. When the upgrade "wizard" was running it asked me with a prompt dialog if I wanted the web application project to target .Net 4.0 instead of .Net 2.0. There is also a check box on that dialog "Do this for all other web projects" which I checked.
However, after the upgrade was completed I found that none of the web application projects other than the initial one it asked me about had been set to .Net 4.0. I had to make these changes manually.
Also, none of the other class libraries were set to .Net 4.0 either. My preference would be that it asks once for the whole solution. I can't imagine that many people would want some projects targeting 2.0 and some targeting 4.0 in the same solution.
  1. When setting the targeting for C# project the option is on the application page of the properties designer. However, in VB projects to get to the targeting selection you have to change to the compile page then click on the "Advanced Options..." dialog to get to the targeting selection.
  2. the membership, profile, role providers have been moved from the System.Web assembly to the System.Web.ApplicationServices. When you modify the target version on your Web application projects to 4.0 this reference is added for you. However, if you have class libraries that use those provider classes you'll have to add this reference to the project yourself.
  3. While we are moving to Entity Framework our current primary data access method is currently typed Datasets and TableAdapters. (Yes I know, it was not my design). Be aware that some of the dataset classes have been moved into System.Data.DataSetExtensions. This reference will be added to the classes where you define your typed datasets when you change the targeting to version 4.0. However it will not be added to projects where you consume your datasets and tableadapters. You must add this reference manually.
  4. It appears that a change was made to the MSDataSetGenerator custom tool. One of our datasets had a "Name" property that was misspelled and didn't match the name of the .XSD file. In .Net 2.0 the dataset's name was used. It appears that in .Net 4 the dataset name property is used. Fixing the typo in the dataset name property resolved all the errors where the dataset was not found.
Well that's about it. All in all upgrading to VS 2010 and .Net framework 4 is not too painful. Of course I am only to the point where it compiles without error. I expect I will run into some issues when we start testing.

No comments:

Post a Comment