Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer &...

41
Migrating from the .NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland

Transcript of Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer &...

Page 1: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Migrating from the .NET Framework Version 1.1 to 2.0

Ken Casada

Developer Evangelist

Developer & Platform Evangelism

Microsoft Switzerland

Page 2: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

.NET Framework 3.0.NET Framework 3.0

Upgrade OptionsUpgrade Options

Breaking changesBreaking changes

Windows Client ApplicationsWindows Client Applications

ASP.NET ApplicationsASP.NET Applications

ResourcesResources

Agenda

Page 3: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Microsoft .NET Framework

The Managed Code The Managed Code

Programming ModelProgramming Model

for Windowsfor Windows

Page 4: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

.NET Framework 3.0.NET Framework 3.0

==.NET Framework 2.0 + bunch of new DLLs.NET Framework 2.0 + bunch of new DLLs

If you have already installed .NET 2.0, If you have already installed .NET 2.0, installing .NET 3.0 will not break installing .NET 3.0 will not break

existing applicationexisting application

Take Away …

Page 5: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Don’t upgradeDon’t upgradeShould do cost/benefits analysis of upgrading Should do cost/benefits analysis of upgrading to VS2005 and .NET Framework 2.0to VS2005 and .NET Framework 2.0

Will features be added?Will features be added?

Will app merely undergo bug fixes?Will app merely undergo bug fixes?

Lifespan of application may factor into decisionLifespan of application may factor into decision

Upgrade Options (1)

Page 6: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Upgrade the Framework to 2.0 (3.0)Upgrade the Framework to 2.0 (3.0)Allows you to develop new apps in 2.0Allows you to develop new apps in 2.0

Maintain your old apps in 1.x (continue to use VS2003 Maintain your old apps in 1.x (continue to use VS2003 as development environment)as development environment)

Run apps side by sideRun apps side by side

Run in 2.0 backward compatibility modeRun in 2.0 backward compatibility mode(improved security, viewstate performance)(improved security, viewstate performance)

Upgrade Options (2)

Page 7: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Which Version Is Used?

Application type Computer with 1.1

Computer with 2.0

Computer with 1.1 and 2.0

1.1 stand-alone application (Web or Microsoft Windows

client)Loads with 1.1 Loads with 2.0(*) Loads with 1.1

2.0 stand-alone application (Web or Microsoft Windows

client)Fails Loads with 2.0 Loads with 2.0

1.1 add-in to a native application (such as Office

or Internet Explorer)Loads with 1.1 Loads with 2.0(*)

Loads with 2.0 unless the process

is configured to run against 1.1 (*)

2.0 add-in to a native application (such as Office

or Internet Explorer) Fails Loads with 2.0 Loads with 2.0

(*) There are some breaking changes in .NET Framework 2.0http://msdn2.microsoft.com/en-us/netframework/aa570326.aspx

Page 8: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Design-mode breaking changesDesign-mode breaking changesDo not impact applications compiled with 1.0 or Do not impact applications compiled with 1.0 or 1.1 running against the .NET Framework 2.01.1 running against the .NET Framework 2.0

Changes in behavior (not necessarily breaking)Changes in behavior (not necessarily breaking)

Fewer than 10 actually impact an applicationFewer than 10 actually impact an application

Runtime-mode breaking changesRuntime-mode breaking changesAPI breaking changes (fewer than 5)API breaking changes (fewer than 5)

Method behavior changesMethod behavior changes

Breaking changes

Page 9: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Short Description

When very long paths are passed to Server.MapPath, they now fail with an InvalidOperationException instead of a PathTooLongException.

Affected APIs System.Web.HttpServerUtility.MapPath Severity Low

Compat Switch Available

No

Description An application that was passing an invalid long path to MapPath in version 1.1 would get a PathTooLongException bubbled up from the BCL. In version 2.0, there is a native code implementation for WebHost that fails the invalid path. The HostingEnvironment then throws an InvalidOperationException, which results in a 500

User Scenario

An application that was passing an invalid long path to MapPath in version 1.1 would get a PathTooLongException bubbled up from the BCL. If the exception was unhandled, the response status code would be 414. In version 2.0, there is a different exception and the status code is 500.

Work Around

In either release, it's an error condition and any global exception handling mechanisms will be treated identically.

Runtime breaking change sample

Page 10: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Protected constructors can no longer be Protected constructors can no longer be called from their derived typescalled from their derived types

Closes a potential security holeCloses a potential security hole

class B { protected B() {} }

class D : B { D() : base () {} // this still works

static void Main() { new B(); // this breaks! } }

Design-Time breaking change sample

Page 11: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Which Version Is Used?

Application type Computer with 1.1

Computer with 2.0

Computer with 1.1 and 2.0

1.1 stand-alone application (Web or Microsoft Windows

client)Loads with 1.1 Loads with 2.0(*) Loads with 1.1

2.0 stand-alone application (Web or Microsoft Windows

client)Fails Loads with 2.0 Loads with 2.0

1.1 add-in to a native application (such as Office

or Internet Explorer)Loads with 1.1 Loads with 2.0(*)

Loads with 2.0 unless the process

is configured to run against 1.1 (*)

2.0 add-in to a native application (such as Office

or Internet Explorer) Fails Loads with 2.0 Loads with 2.0

(*) There are some breaking changes in .NET Framework 2.0http://msdn2.microsoft.com/en-us/netframework/aa570326.aspx

Page 12: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Locate the unmanaged .EXELocate the unmanaged .EXE

Create a text file calledCreate a text file called<unmanagedEXEname>.exe.config

(Ex: myapp.exe myapp.exe.config)

Paste this text into the new text file:Paste this text into the new text file:<?xml version=“1.0”><?xml version=“1.0”>

<configuration><configuration>

<startup><startup>

<supportedRuntime version=“v1.1.4322”/><supportedRuntime version=“v1.1.4322”/>

</startup></startup>

</configuration></configuration>

Load Specific Version (EXE)

Page 13: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Installing .NET Framework installs ASP.NET 2.0Installing .NET Framework installs ASP.NET 2.0

By default, this will not change existing IIS Web By default, this will not change existing IIS Web Sites to 2.0, they will remain to 1.1/1.0Sites to 2.0, they will remain to 1.1/1.0

Web site runtime controlled by the new ASP.NET Web site runtime controlled by the new ASP.NET tab in IIS Admin (site properties)tab in IIS Admin (site properties)

Important!Important!DO NOT try to mix ASP.NET 1.1 and 2.0 apps within a DO NOT try to mix ASP.NET 1.1 and 2.0 apps within a single AppPool.single AppPool.

Create separate AppPools for each Version!Create separate AppPools for each Version!

Load Specific Version (ASP.NET)

Page 14: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Web Application:- side by side deployments

- 2.0 backward compatibility mode

Page 15: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Convert your Application to 2.0Convert your Application to 2.0Upgrade to VS2005 SP1 ! (VS2005 SP1 Upgrade to VS2005 SP1 ! (VS2005 SP1 Update for Windows Vista available)Update for Windows Vista available)

Develop your application in Microsoft Visual Develop your application in Microsoft Visual Studio 2005Studio 2005

Use new .NET 2.0 feature ! Use new .NET 2.0 feature !

Upgrade Options (3)

Page 16: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Back up your VS2003/1.1 solution first!Back up your VS2003/1.1 solution first!

Open VS2003 project/solution in VS2005 Open VS2003 project/solution in VS2005 SP1Conversion wizard convert project/solution to Conversion wizard convert project/solution to

VS 2005VS 2005

Compile the codeCompile the code

Convert your Application to 2.0

Page 17: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Convert Windows Client Applications

Trivial in most casesTrivial in most casesOpen the solution in VS2005Open the solution in VS2005

Wizard does necessary touchups to project filesWizard does necessary touchups to project files

If it doesn’t work at this point, check the If it doesn’t work at this point, check the breaking changes listbreaking changes list

Not a lot of issues out there with this scenarioNot a lot of issues out there with this scenario

Best way to find out is to just try itBest way to find out is to just try itBackup your files (don’t forget this, just in case!)Backup your files (don’t forget this, just in case!)

See if it works as isSee if it works as is

Page 18: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Convert ASP.NET Applications

Converting to VS2005 Web Applications Converting to VS2005 Web Applications (Option#1)(Option#1)

Web Application ProjectWeb Application Project template (included in VS2005 template (included in VS2005 SP1) that mirrors the 1.1 file structure and use itSP1) that mirrors the 1.1 file structure and use itMinimal changes to VS2003 codeMinimal changes to VS2003 codeFor complex web application, this may be the better For complex web application, this may be the better choicechoiceRecommended choiceRecommended choice

Converting to VS2005 Websites (Option#2)Converting to VS2005 Websites (Option#2)Referred to as the Referred to as the web siteweb site template templateWeb app defined by files in a folder (No project file Web app defined by files in a folder (No project file needed)needed)Dynamic Compilation / Multiple assembliesDynamic Compilation / Multiple assemblies

Page 19: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

If remote project connected via FPSE, If remote project connected via FPSE, move to http://localhost in VS03 prior to move to http://localhost in VS03 prior to upgradingupgrading

Open using the solution file in VS03Open using the solution file in VS03

Do a build solution command to validate Do a build solution command to validate all projects in the solution buildall projects in the solution build

Run and validate all pages function Run and validate all pages function correctlycorrectly

Step 1: Validate in VS2003Opt#1

Page 20: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Open SLN file in VS2005 Open SLN file in VS2005 Launches Launches Conversion WizardConversion Wizard

Make sure to make a backupMake sure to make a backup

Convertion Wizard updates solution file and Convertion Wizard updates solution file and projects files to VS2005 syntax projects files to VS2005 syntax

After conversion build and fixup errorsAfter conversion build and fixup errorsName collisions with new types in frameworkName collisions with new types in framework

fully qualify names with namespacefully qualify names with namespace

Warnings about using obsolete membersWarnings about using obsolete members

Run application and validate functionalityRun application and validate functionality

Step 2: Upgrade solutionOpt#1

Page 21: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Right click on root node of Web project Right click on root node of Web project and select “Convert to Web Application”and select “Convert to Web Application”

Converts pages to using partial classesConverts pages to using partial classes

Moves generated designer code into Moves generated designer code into designer.cs (or designer.vb) filedesigner.cs (or designer.vb) file

Build and fixup errorsBuild and fixup errorsLikely error, if any, will be because of a Likely error, if any, will be because of a missing control declaration that was missing control declaration that was accidentally removedaccidentally removed

To fixup declare missing controls in code-To fixup declare missing controls in code-behind file (not designer file)behind file (not designer file)

Step 3: Convert To Partial ClassesOpt#1

Page 22: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Partial ClassesVisual Studio 2003 Visual Studio 2005 P2.aspx

P2.aspx.cs

P1.aspx

P1.aspx.csP2.aspx.designer.cs

Opt#1

Page 23: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Visual Studio 2003 Visual Studio 2005 P2.aspx

P2.aspx.cs

P1.aspx

P1.aspx.cs

P1.aspxInherits=“AppName.P1”Codebehind=“P1.aspx.cs”

P1.aspx.csnamespace AppName { public class P1 : System.Web.UI.Page { // Contains both user & auto-generated code, e.g. protected System.Web.UI.WebControls.Label Label1; override protected void OnInit(EventArgs e) { … }} }

P2.aspx.designer.cs

Partial ClassesOpt#1

Page 24: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

P2.aspxInherits=“P2”CodeBehind=“P2.aspx.cs”

P2.aspx.csnamespace AppName { public partial class P2 : System.Web.UI.Page { // Contains user code} }P2.aspx.designer.csnamespace AppName { public partial class P2{

protected System.Web.UI.WebControls.Label Label1;override protected void OnInit(EventArgs e)} }

Partial ClassesVisual Studio 2003 Visual Studio 2005 P2.aspx

P2.aspx.cs

P1.aspx

P1.aspx.csP2.aspx.designer.cs

Opt#1

Page 25: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Right click on root node of Web project Right click on root node of Web project and select “Convert to Web Application”and select “Convert to Web Application”

Converts pages to using partial classesConverts pages to using partial classes

Moves generated designer code into Moves generated designer code into designer.cs (or designer.vb) filedesigner.cs (or designer.vb) file

Build and fixup errorsBuild and fixup errorsLikely error, if any, will be because of a Likely error, if any, will be because of a missing control declaration that was missing control declaration that was accidentally removedaccidentally removed

To fixup declare missing controls in code-To fixup declare missing controls in code-behind file (not designer file)behind file (not designer file)

Step 3: Convert To Partial ClassesOpt#1

Page 26: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Conversion Wizard sets default validation Conversion Wizard sets default validation in tool to Internet Explorer 6in tool to Internet Explorer 6

VS2005 provides the ability to validate VS2005 provides the ability to validate XHTML compliance errorsXHTML compliance errors

Change validation in Tools Option to XHTML Change validation in Tools Option to XHTML 1.11.1

Open individual pages and fixup XHTML Open individual pages and fixup XHTML issues.issues.

If XHTML compliance isn’t desired leave If XHTML compliance isn’t desired leave validation to Internet Explore 6validation to Internet Explore 6

Step 4: Fixup XHTML errorsOpt#1

Page 27: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Converting to VS2005 Web Applications

Opt#1

Page 28: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Convert ASP.NET Applications

Converting to VS2005 Web Applications Converting to VS2005 Web Applications (Option#1)(Option#1)

Web Application ProjectWeb Application Project template (included in VS2005 template (included in VS2005 SP1) that mirrors the 1.1 file structure and use itSP1) that mirrors the 1.1 file structure and use itMinimal changes to VS2003 codeMinimal changes to VS2003 codeFor complex web application, this may be the better For complex web application, this may be the better choicechoiceRecommended choiceRecommended choice

Converting to VS2005 Websites (Option#2)Converting to VS2005 Websites (Option#2)Referred to as the Referred to as the web siteweb site template templateWeb app defined by files in a folder (No project file Web app defined by files in a folder (No project file needed)needed)Dynamic Compilation / Multiple assembliesDynamic Compilation / Multiple assemblies

Page 29: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Open Web Project in VS2003 using Open Web Project in VS2003 using solution or project filesolution or project file

Do a build solution command to validate Do a build solution command to validate all projects in the solution buildall projects in the solution build

Run project and test pages to validate all Run project and test pages to validate all pages run correctlypages run correctly

Step 1: Validate in VS2003Opt#2

Page 30: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Review the web site architecture for Review the web site architecture for possible VS05 conflicts including:possible VS05 conflicts including:

Multiple project files referring to same set of files Multiple project files referring to same set of files (common files ca be migrated twice)(common files ca be migrated twice)

Duplicate? Evtl. migrate to WAPDuplicate? Evtl. migrate to WAP

Other projects referencing the web projectOther projects referencing the web project

move shared code to a separate class librarymove shared code to a separate class library

Excluded Files ignored by the Wizard (project will Excluded Files ignored by the Wizard (project will contain extra unconverted files that are now part of contain extra unconverted files that are now part of your project)your project)

Step 2: Prepare App. in VS2003Opt#2

Page 31: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Step 3: Upgrade to VS2005Opt#2

Open using “File > Open Website > Local Open using “File > Open Website > Local IIS” IIS” Launches Conversion Wizard Launches Conversion Wizard

Backup your projectBackup your project Backup Folder outside Web application’s folder tree! Backup Folder outside Web application’s folder tree!

If other non-web projects are in VS03 If other non-web projects are in VS03 solution:solution:1.1. Remove Web Projects from SolutionRemove Web Projects from Solution

2.2. Migration Solution and fixup compile errorsMigration Solution and fixup compile errors

3.3. Use “Add Existing Website” to add removed Use “Add Existing Website” to add removed Web projects to solution, which will upgrade the Web projects to solution, which will upgrade the web project to a websiteweb project to a website

Page 32: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Step 4: Post Conversion Fixup

Review upgrade report and fixup Review upgrade report and fixup compile issues reported on buildcompile issues reported on build

Refactor code for reserved word naming Refactor code for reserved word naming conflictsconflicts

Clean up:Clean up:Remove exclude files if neededRemove exclude files if needed

Remove orphaned resx filesRemove orphaned resx files

Remove member functions like OnInit and Remove member functions like OnInit and InitializeComponent() (if they don’t implement InitializeComponent() (if they don’t implement user specific code)user specific code)

Opt#2

Page 33: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Step 4: Post Conversion Fixup

……Because of new web site compilation Because of new web site compilation model…model…

Manual fix-up needed:Manual fix-up needed:Resource Manager sampleResource Manager sample

CircularReferenceCircularReference

Code changes done by the Code changes done by the conversion Wizardconversion Wizard

stand-alone class file referencesstand-alone class file references

Access auto-generated control variableAccess auto-generated control variable

Opt#2

Page 34: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Conversion Wizard sets default validation Conversion Wizard sets default validation in tool to Internet Explorer 6in tool to Internet Explorer 6

VS2005 provides the ability to validate VS2005 provides the ability to validate XHTML compliance errorsXHTML compliance errors

Change validation in Tools Option to XHTML Change validation in Tools Option to XHTML 1.11.1

Open individual pages and fixup XHTML Open individual pages and fixup XHTML issues.issues.

If XHTML compliance isn’t desired leave If XHTML compliance isn’t desired leave validation to Internet Explore 6validation to Internet Explore 6

Step 5: Fixup XHTML errorsOpt#2

Page 35: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Converting to VS2005 Websites

Opt#2

Page 36: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

ABC - stand-alone class file ref.

FILEFILE ASP.NET 2.0 CodeASP.NET 2.0 Code

Control1.ascxControl1.ascx inherits=”inherits=”migrated_Control1migrated_Control1””

Control1.ascx.csControl1.ascx.cs class class migrated_Control1migrated_Control1 : : Control1Control1 { { overrideoverride public void foo() { some code } public void foo() { some code }

} }

App_Code/App_Code/Class1.csClass1.cs

String myName = “Class1 + “ + String myName = “Class1 + “ + Control1Control1.myName;.myName;

App_Code/App_Code/Control1_stub.csControl1_stub.cs

abstract class abstract class Control1Control1 : System.Web.UI.UserControl : System.Web.UI.UserControl {{ public static string myName = “Control1”; public static string myName = “Control1”; abstract public void foo();} abstract public void foo();}

FILEFILE ASP.NET 1.x CodeASP.NET 1.x Code

Control1.ascxControl1.ascx inherits=”Control1”inherits=”Control1”

Control1.ascx.csControl1.ascx.cs class Control1 : System.Web.UI.UserControl { class Control1 : System.Web.UI.UserControl { public static string myName = “Control1”; public static string myName = “Control1”; public void foo() { some code } public void foo() { some code }

}}

Class1.csClass1.cs string myName = “Class1 + “ + Control1.myName;string myName = “Class1 + “ + Control1.myName;

Opt#2

Page 37: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Auto-generated control variable

FILEFILE ASP.NET 2.0 CodeASP.NET 2.0 Code

Control1.ascxControl1.ascx <asp:Label id=“<asp:Label id=“p_Label1p_Label1” runat=“server”>c1</asp:Label>” runat=“server”>c1</asp:Label>

Control1 Control1 hidden partial hidden partial classclass

//this will be auto-generated in the hidden, partial class//this will be auto-generated in the hidden, partial class

protectedprotected System.Web.UI.WebControls.Label System.Web.UI.WebControls.Label p_Label1p_Label1;;

Control1.ascx.Control1.ascx.cscs

publicpublic System.Web.UI.WebControls.Label System.Web.UI.WebControls.Label Label1Label1{{

get { return get { return p_Label1p_Label1;};}

set { set { p_Label1p_Label1 = value;}= value;}

}}

Page1.aspx.csPage1.aspx.cs Control1 c1=(Control1)LoadControl(“~/Control1.ascx”);Control1 c1=(Control1)LoadControl(“~/Control1.ascx”);

C1.C1.Label1Label1.Text = “Foo”;.Text = “Foo”;

FILEFILE ASP.NET 1.x CodeASP.NET 1.x Code

Control1.ascxControl1.ascx <asp:Label id=“Label1” runat=“server”>c1</asp:Label><asp:Label id=“Label1” runat=“server”>c1</asp:Label>

Control1.ascx.Control1.ascx.cscs

publicpublic System.Web.UI.WebControls.Label System.Web.UI.WebControls.Label Label1Label1;;

Page1.aspx.csPage1.aspx.cs Control1 c1=(Control1)LoadControl(“~/Control1.ascx”);Control1 c1=(Control1)LoadControl(“~/Control1.ascx”);

C1.C1.Label1Label1.Text = “Foo”;.Text = “Foo”;

Opt#2

Page 38: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Resource Manager

FILEFILE ASP.NET 2.0 CodeASP.NET 2.0 Code

Control1.ascx.csControl1.ascx.cs String s = Resources.String s = Resources.Resource1Resource1.foo;.foo;

App_GlobalResources\App_GlobalResources\

Resource1.resxResource1.resxResource1.resx moved to App_GlobalResourceResource1.resx moved to App_GlobalResource

Contains name/value pair “foo = bar”Contains name/value pair “foo = bar”

FILEFILE ASP.NET 1.x CodeASP.NET 1.x Code

Control1.ascx.csControl1.ascx.cs Assembly a = Assembly a = Assembly.Load(“myApp”);Assembly.Load(“myApp”);

ResourceManager rm = new ResourceManager rm = new ResourceManager(“myApp.Resource1”, a);ResourceManager(“myApp.Resource1”, a);

String s = rm.GetString(“foo”);String s = rm.GetString(“foo”);

Resource1.resxResource1.resx Contains name/value pair “foo = bar”Contains name/value pair “foo = bar”

Opt#2

Page 39: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

Q2 Q3 Q12007

Q2Q4Q1 Q3 Q4

3.5RTM

Microsoft .NET Framework Ship Schedule

3.0RTM

.NET Framework 3.5:.NET Framework 3.5:

Q4 2007Q4 2007

SP for .Net Framework 2.0 (bug fixing)SP for .Net Framework 2.0 (bug fixing)

3.5B1

Page 40: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.

For More Information

Converting to a Web Application Project (WAP)Converting to a Web Application Project (WAP)http://webproject.scottgu.comhttp://webproject.scottgu.com

Converting to a Web Site Project (WSP)Converting to a Web Site Project (WSP)http://msdn.microsoft.com/asp.net/reference/migration/upgradehttp://msdn.microsoft.com/asp.net/reference/migration/upgrade

Common Web Project Conversion Issues and SolutionsCommon Web Project Conversion Issues and Solutions

Step-By-Step Guide to Converting Web Projects from VS03 Step-By-Step Guide to Converting Web Projects from VS03 to VS05to VS05

Questions – Forums: Migrating from VS03 to VS05Questions – Forums: Migrating from VS03 to VS05http://forums.asp.net/default.aspxhttp://forums.asp.net/default.aspx

Page 41: Migrating from the.NET Framework Version 1.1 to 2.0 Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland.