1 / 41

Migrating from the .NET Framework Version 1.1 to 2.0

Migrating from the .NET Framework Version 1.1 to 2.0. Ken Casada Developer Evangelist Developer & Platform Evangelism Microsoft Switzerland. Agenda. .NET Framework 3.0 Upgrade Options Breaking changes Windows Client Applications ASP.NET Applications Resources. Microsoft .NET Framework.

halona
Download Presentation

Migrating from the .NET Framework Version 1.1 to 2.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Agenda • .NET Framework 3.0 • Upgrade Options • Breaking changes • Windows Client Applications • ASP.NET Applications • Resources

  3. Microsoft .NET Framework The Managed Code Programming Model for Windows

  4. Take Away … .NET Framework 3.0 = .NET Framework 2.0 + bunch of new DLLs If you have already installed .NET 2.0, installing .NET 3.0 will not break existing application

  5. Upgrade Options (1) • Don’t upgrade • Should do cost/benefits analysis of upgrading to VS2005 and .NET Framework 2.0 • Will features be added? • Will app merely undergo bug fixes? • Lifespan of application may factor into decision

  6. Upgrade Options (2) • Upgrade the Framework to 2.0 (3.0) • Allows you to develop new apps in 2.0 • Maintain your old apps in 1.x (continue to use VS2003 as development environment) • Run apps side by side • Run in 2.0 backward compatibility mode(improved security, viewstate performance)

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

  8. Breaking changes • Design-mode breaking changes • Do not impact applications compiled with 1.0 or 1.1 running against the .NET Framework 2.0 • Changes in behavior (not necessarily breaking) • Fewer than 10 actually impact an application • Runtime-mode breaking changes • API breaking changes (fewer than 5) • Method behavior changes

  9. Runtime breaking change sample

  10. Design-Time breaking change sample • Protected constructors can no longer be called from their derived types • Closes a potential security hole class B { protected B() {} } class D : B { D() : base () {} // this still works staticvoid Main() { new B(); // this breaks! } }

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

  12. Load Specific Version (EXE) • Locate the unmanaged .EXE • Create a text file called <unmanagedEXEname>.exe.config (Ex: myapp.exe myapp.exe.config) • Paste this text into the new text file: <?xml version=“1.0”> <configuration> <startup> <supportedRuntime version=“v1.1.4322”/> </startup> </configuration>

  13. Load Specific Version (ASP.NET) • Installing .NET Framework installs ASP.NET 2.0 • By default, this will not change existing IIS Web Sites to 2.0, they will remain to 1.1/1.0 • Web site runtime controlled by the new ASP.NET tab in IIS Admin (site properties) • Important! DO NOT try to mix ASP.NET 1.1 and 2.0 apps within a single AppPool.  Create separate AppPools for each Version!

  14. Web Application:- side by side deployments- 2.0 backward compatibility mode

  15. Upgrade Options (3) • Convert your Application to 2.0 • Upgrade to VS2005 SP1 ! (VS2005 SP1 Update for Windows Vista available) • Develop your application in Microsoft Visual Studio 2005  Use new .NET 2.0 feature !

  16. Convert your Application to 2.0 • Back up your VS2003/1.1 solution first! • Open VS2003 project/solution in VS2005 SP1 • Conversion wizard convert project/solution to VS 2005 • Compile the code

  17. Convert Windows Client Applications • Trivial in most cases • Open the solution in VS2005 • Wizard does necessary touchups to project files • If it doesn’t work at this point, check the breaking changes list • Not a lot of issues out there with this scenario • Best way to find out is to just try it • Backup your files (don’t forget this, just in case!) • See if it works as is

  18. Convert ASP.NET Applications • Converting to VS2005 Web Applications (Option#1) • Web Application Project template (included in VS2005 SP1) that mirrors the 1.1 file structure and use it • Minimal changes to VS2003 code • For complex web application, this may be the better choice • Recommended choice • Converting to VS2005 Websites (Option#2) • Referred to as the web site template • Web app defined by files in a folder (No project file needed) • Dynamic Compilation / Multiple assemblies

  19. Step 1: Validate in VS2003 Opt#1 • If remote project connected via FPSE, move to http://localhost in VS03 prior to upgrading • Open using the solution file in VS03 • Do a build solution command to validate all projects in the solution build • Run and validate all pages function correctly

  20. Step 2: Upgrade solution Opt#1 • Open SLN file in VS2005  Launches Conversion Wizard • Make sure to make a backup • Convertion Wizard updates solution file and projects files to VS2005 syntax • After conversion build and fixup errors • Name collisions with new types in framework  fully qualify names with namespace • Warnings about using obsolete members • Run application and validate functionality

  21. Step 3: Convert To Partial Classes Opt#1 • Right click on root node of Web project and select “Convert to Web Application” • Converts pages to using partial classes • Moves generated designer code into designer.cs (or designer.vb) file • Build and fixup errors • Likely error, if any, will be because of a missing control declaration that was accidentally removed • To fixup declare missing controls in code-behind file (not designer file)

  22. Partial Classes Opt#1 Visual Studio 2003 Visual Studio 2005 P1.aspx P2.aspx P1.aspx.cs P2.aspx.cs P2.aspx.designer.cs

  23. Partial Classes Opt#1 Visual Studio 2003 Visual Studio 2005 P1.aspx P2.aspx P1.aspx.cs P2.aspx.cs P2.aspx.designer.cs P1.aspx Inherits=“AppName.P1” Codebehind=“P1.aspx.cs” P1.aspx.cs namespace 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) { … } } }

  24. Partial Classes Opt#1 Visual Studio 2003 Visual Studio 2005 P1.aspx P2.aspx P1.aspx.cs P2.aspx.cs P2.aspx.designer.cs P2.aspx Inherits=“P2” CodeBehind=“P2.aspx.cs” P2.aspx.cs namespace AppName { public partial class P2 : System.Web.UI.Page { // Contains user code } } P2.aspx.designer.cs namespace AppName { public partial class P2{ protected System.Web.UI.WebControls.Label Label1; override protected void OnInit(EventArgs e)} }

  25. Step 3: Convert To Partial Classes Opt#1 • Right click on root node of Web project and select “Convert to Web Application” • Converts pages to using partial classes • Moves generated designer code into designer.cs (or designer.vb) file • Build and fixup errors • Likely error, if any, will be because of a missing control declaration that was accidentally removed • To fixup declare missing controls in code-behind file (not designer file)

  26. Step 4: Fixup XHTML errors Opt#1 • Conversion Wizard sets default validation in tool to Internet Explorer 6 • VS2005 provides the ability to validate XHTML compliance errors • Change validation in Tools Option to XHTML 1.1 • Open individual pages and fixup XHTML issues. • If XHTML compliance isn’t desired leave validation to Internet Explore 6

  27. Opt#1 Converting to VS2005 Web Applications

  28. Convert ASP.NET Applications • Converting to VS2005 Web Applications (Option#1) • Web Application Project template (included in VS2005 SP1) that mirrors the 1.1 file structure and use it • Minimal changes to VS2003 code • For complex web application, this may be the better choice • Recommended choice • Converting to VS2005 Websites (Option#2) • Referred to as the web site template • Web app defined by files in a folder (No project file needed) • Dynamic Compilation / Multiple assemblies

  29. Step 1: Validate in VS2003 Opt#2 • Open Web Project in VS2003 using solution or project file • Do a build solution command to validate all projects in the solution build • Run project and test pages to validate all pages run correctly

  30. Step 2: Prepare App. in VS2003 Opt#2 • Review the web site architecture for possible VS05 conflicts including: • Multiple project files referring to same set of files (common files ca be migrated twice)  Duplicate? Evtl. migrate to WAP • Other projects referencing the web project  move shared code to a separate class library • Excluded Files ignored by the Wizard (project will contain extra unconverted files that are now part of your project)

  31. Step 3: Upgrade to VS2005 Opt#2 • Open using “File > Open Website > Local IIS”  Launches Conversion Wizard • Backup your project Backup Folder outside Web application’s folder tree! • If other non-web projects are in VS03 solution: • Remove Web Projects from Solution • Migration Solution and fixup compile errors • Use “Add Existing Website” to add removed Web projects to solution, which will upgrade the web project to a website

  32. Opt#2 Step 4: Post Conversion Fixup • Review upgrade report and fixup compile issues reported on build • Refactor code for reserved word naming conflicts • Clean up: • Remove exclude files if needed • Remove orphaned resx files • Remove member functions like OnInit and InitializeComponent() (if they don’t implement user specific code)

  33. Opt#2 Step 4: Post Conversion Fixup …Because of new web site compilation model… • Manual fix-up needed: • Resource Manager sample • CircularReference • Code changes done by the conversion Wizard • stand-alone class file references • Access auto-generated control variable

  34. Step 5: Fixup XHTML errors Opt#2 • Conversion Wizard sets default validation in tool to Internet Explorer 6 • VS2005 provides the ability to validate XHTML compliance errors • Change validation in Tools Option to XHTML 1.1 • Open individual pages and fixup XHTML issues. • If XHTML compliance isn’t desired leave validation to Internet Explore 6

  35. Opt#2 Converting to VS2005 Websites

  36. Opt#2 ABC - stand-alone class file ref.

  37. Opt#2 Auto-generated control variable

  38. Opt#2 Resource Manager

  39. 3.5 RTM 3.0 RTM Q1 Q2 Q3 Q4 Q1 2007 Q2 Q3 Q4 Microsoft .NET Framework Ship Schedule 3.5 B1 • .NET Framework 3.5: • Q4 2007 • SP for .Net Framework 2.0 (bug fixing)

  40. For More Information • Converting to a Web Application Project (WAP)http://webproject.scottgu.com • Converting to a Web Site Project (WSP)http://msdn.microsoft.com/asp.net/reference/migration/upgrade • Common Web Project Conversion Issues and Solutions • Step-By-Step Guide to Converting Web Projects from VS03 to VS05 Questions – Forums: Migrating from VS03 to VS05http://forums.asp.net/default.aspx

More Related