migrating visual basic applications to vb.net using the

10
Migrating Visual Basic Applications to VB.NET using the NewCode extension for Microsoft Visual Studio The era that was VB6

Upload: khangminh22

Post on 15-Mar-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

Migrating Visual Basic Applications to VB.NET using the

NewCode extension for Microsoft Visual Studio

The era that was VB6

Migrating Visual Basic to VB.NET with the NewCode

extension for Microsoft Visual Studio

Introduction This document outlines the migration processes, architectural features and deployment options when using the NewCode extension for Microsoft Visual Studio (2005 or 2008) to migrate Visual Basic applications to VB.NET.

The NewCode architected, migration toolset provides a re-engineering environment and automated code generation capability for migrating Microsoft Visual Basic legacy applications into .NET applications. The toolset runs as an extension to Microsoft Visual Studio. The legacy source code is parsed and transformed into a Domain Specific Model language (DSL) XML model, with model elements representing application components. The tool then automatically generates the model and associated code templates. The user can perform additional re-engineering on the model to implement reuse of code and enhancements such as inheritance, associations, class operations and more. The target .NET application code can then be generated from customisable, T4 templates that are linked to model elements. Uniquely, with NewCode it is possible to re-architect the solution from a two-tier, client server application built with a structured methodology to an n-tier .NET application built with an object-oriented methodology. This is because modernization with NewCode is a multi-step approach that enables the user to create and work with application models in order to decompose the application into object-oriented entities (if required). We recognize that no tool could fully automate such a process so we provide a patented process with modelling capability to allow users to complete this element of the migration work rapidly and to facilitate acceptance testing.

NewCode Migration Wizard in Microsoft Visual Studio 2008

PATTERNS & PRACTICES All application components generated by NewCode are built on standards defined by Microsoft Patterns and Practises. Microsoft's recommendations for how to design, develop, deploy, and operate architecturally-sound applications for the Microsoft application platform. The NewCode migration wizard offers a choice of target application pattern including the „Model-View-Controller‟ pattern. THE BENEFITS OF MIGRATING WITH NewCode Here are some of the many benefits that can be derived from NewCode's unique approach to the migration and accelerated development of .NET applications with NewCode:

Remove your company from a de-support situation. Microsoft Visual Basic 6 will no longer be supported by Microsoft from the end of March 2008.

NewCode is not a simple line-by-line upgrade wizard. NewCode offers the opportunity for application re-engineering as part of its multi-step migration approach.

NewCode automatically maps objects and functions to the .NET equivalent (where possible)

NewCode generates comprehensive documentation from customisable templates and a full

migration report.

The code generated by NewCode is derived from the model and associated code templates, which

empowers the user to customise the results – this feature is not available in existing upgrade wizards.

The NewCode underlying model design and code templates are themselves derived from Microsoft

Patterns and Practices. NewCode virtually eliminates expensive pre-analysis effort to 15%, an 85% reduction in the time

required to manually perform the same analysis of Visual Basic code NewCode does not require a proprietary framework or run-time dependencies.

Automatically enforce .NET 2, .NET 3.5 standards and beyond.

Achieve massive increases in productivity from pattern-based, model-driven development over a

manual coding of .NET artifacts.

Remove the risk of error associated with tedious “eye-balling” of legacy source code and other security risks associated with manual coding.

Leverage your existing investment in database and application logic

Tackle the problem of the dwindling developer skills available for legacy languages such as VB6

Customers developing and deploying applications using the NewCode tool-set have full ownership

rights of the generated code and associated model

Dramatically reduce annual spend on expensive and scarce development and testing resources.

Drive business strategy as NewCode eliminates the time gap between agreed strategy and the IT departments ability to deliver

System Prerequisites

NewCode for Visual Studio requires the following minimum system configuration:

Component Recommended Requirement

Processor Intel Pentium® III (1.6 GHz or higher recommended) AMD Dual Core

RAM Minimum 1Gb of available, physical RAM

IDE Microsoft Visual Studio 2005 Standard/Professional/Team Version 8.+ Microsoft Visual Studio 2008 Standard/Professional/Team Version 9.+

Operating System Microsoft Windows Server 2003 R2 Microsoft Windows XP with service Pack 2 Microsoft Windows Vista

Browser Microsoft Internet Explorer 5.5+, Netscape Navigator 4.07 or equivalent

.NET Framework Microsoft .NET Framework Version 2.0 with Service Pack 1 Microsoft .NET Framework Version 3.5

Microsoft Visual Basic™ 3.0 – 6.0

Product Overview With NewCode, the customer can achieve architected migrations that leverage the benefits of .NET - far beyond the capabilities of simple line-by-line code convertors.

The Process Inputs After product installation, the user can run the NewCode migration wizard from within Visual Studio. The wizard collects the following information from the user: 1. Select Target Language (VB.NET), application type and .NET Framework 2. The user browses and selects their legacy, Visual Basic 3 – 6 application files. The user can select project files, non-project files, individual or multiple files and projects with missing files. 3. The wizard counts the number of code lines in the selected files (including files referenced within VB project files). The code line count excludes comment lines and white space lines. 4. Select the target application pattern. 5. The user enters their email and password (as used when they registered at www.newcode.com) 6. The Wizard authenticates the user and authorises their migration usage based on the number lines of code required. If the user has insufficient code lines credit, they can logon to their NewCode account and purchase additional credit. 7. Run the Wizard Running The Migration Wizard The wizard performs the following automated conversion tasks: • Creates a Visual Studio Solution and Project • Runs the NewCode Visual Basic Parser which processes the entire set of VB input files (See Further Details Below). • Identifies and skips dead code • Restructures unstructured code • Converts up to 90% of the Visual Basic system to standard VB.NET code using an AST (Abstract syntax tree) based on a purpose designed language grammar. • Generates a DSL model • Generates data access code via ADO.NET • Generates code documentation • Preserves in the migrated code the name of the original VB command structures, variable names, routine names and programmer comments • Generates code templates linked to the model • Generates a migration report Modelling The wizard assimilates the results of the conversion into a DSL model (Domain Specific Language) representing the target .NET application. Any legacy application code that could not be readily transformed into model elements is placed in Code Block files. The code block files are linked to operation model elements and contain .NET code converted from the legacy source. The NewCode model is built on the Microsoft DSL tooling and provides a powerful means of re-engineering and maintaining applications post migration. The model includes a full range of user interface and services model elements including Forms, Operations, Controls, Classes and Modules. Entire applications can be represented in the model and its associated code blocks. Following migration the user can re-engineer their application by adding, removing or updating model elements and their properties. Because NewCode is also a development environment, new application components can be easily modelled. Class Diagram The NewCode model can be represented both in a graphical class diagram view, complete with Toolbox for adding new model elements and in a class diagrams explorer view. Code Generation Following re-engineering (and at any time post-migration) code can be generated from the model using the T4 templates initially generated by NewCode, which can be then customised.

A NewCode Migration Project and Model in Microsoft Visual Studio 2008

The Visual Basic Language Parser The NewCode Visual Basic Parser understands and converts all commands and data types with few exceptions.

The Visual Basic Language Parser The NewCode Visual Basic Language Parser undertakes the preliminary work involved with migrating a Visual Basic application to .NET. The adaptor will analyse the source application and construct a NewCode model that can be used to re-engineer a target application. The generated model reduces the process of migration to a single re-engineering phase during which the user can customise the model to suit the architectural requirements. Dependencies/Requirements:

The adaptor will process Visual Basic files of type .vbp, as well as the ability to select individual .bas, cls, and .frm files.

The adaptor operates by converting each source file into an Abstract Syntax

Tree or AST. This tree is then used to move the source application into the NewCode model.

The controls on the VB form are analysed and mapped to .NET controls.

Compatible properties including names and labels are migrated consistently, allowing easy identification on the model for re-engineering.

Parser Tasks: Processing .cls and .bas files:

1. Parse the file prolog 2. Parse version 3. Parse class name 4. Parse referenced objects 5. Parse Attributes 6. Parse Data Structures 7. Parse Property Get, Property Let, Type, Enum, Sub Procedures, Function and

Function Declarations 8. Parse Comments 9. Parse white Lines 10. Parse Option explicit 11. Parse Variable declarations 12. Parse Operations

Processing .frm files:

1. parse the prolog 2. Parse version 3. Parse class name 4. Parse Form Types including MDI Forms 5. Parse referenced objects 6. Parse Attributes 7. Parse Constants 8. Parse Form Controls 9. Identify Nested Controls 10. Identify and Correct Duplicate Control Names 11. Parse Form Control Properties 12. Parse Property Get, Property Let, Type, Enum, Sub Procedures, Function and

Function Declarations 13. Parse Comments 14. Parse white Lines 15. Parse Option explicit 16. Parse Variable declarations 17. Parse Operations

Code Block Processing:

1. Convert Control Methods in Form Code Blocks 2. Convert Application Procedure Calls in Code Blocks 3. Convert VB Built In Procedure Calls in Code Blocks 4. Convert Form Procedure Signatures 5. Convert Events for target .NET Framework 6. Convert Data Types 7. Handle „Optional‟ Word in Procedure Signatures 8. Process Optional Default Value 9. Convert Class Module Procedure Signatures 10. Convert Visual Basic Constants

e.g. "vbHourglass" to "System.Windows.Forms.Cursors.WaitCursor" 11. Convert Visual Basic Functions 12. Convert Visual Basic Statements 13. Convert Visual Basic Operators 14. Convert Visual Basic Objects 15. Convert Visual Basic Forms 16. Convert Visual Basic Controls 17. Parse Code Blocks 18. Object mapping references e.g. the App Object 19. Error Handling: Implement Try-Catch Blocks

Map Third Party Controls including:

1. CSCmdBtn 2. DTPicker 3. MSFlexGrid 4. MSHFlexGrid 5. VSFlexGrid 6. VSPrinter 7. C1Elastic 8. csLabel 9. Line3D 10. SSTab 11. csTextBox 12. sitxEdit

Code Generation:

1. Generate Class Header 2. Generate Attributes Code (Variables, whitespaces, Comments, Constants,

Function Declarations) 3. Generate Operations Code (Sub, Function, Property, Structure, enum) 4. Classes & Modules: write .vb files 5. Forms: Generate the designer and resx code 6. Forms: write .vb, .Designer.vb and .resx files

Other Tasks:

1. Build The Target application Model 2. Add Code Blocks 3. Get Code Templates and generate code from the model and code blocks 4. Generate Documentation 5. updateMigrationReportArray 6. updateMigrationReport

Assumptions:

The VB language parser is not a compiler. Thus we recommend that you compile your source application before using the adaptor. If errors exist in your source application then the parser will generate an error and cannot correct the offending code.

If a parser error has occurred then a record note will be added to the migration

report.

If the code translation process is unable to identify .NET equivalents, then a record is written to the migration report together with links to reference information.

Migration Project Offering

The legacy transformation process is a cost-effective way of leveraging existing investments whilst reducing operational costs and accessing the capabilities of the latest application server technologies.

NewCode provides migration services with Industry leading partners. We recommend a stage-by-stage approach to migration and transformation projects which combines the automation potential of NewCode Edition for Microsoft Visual Studio with the experience of our professional consultants or systems integrations: The NewCode Services Solution can include:

Project Assessment Services

Migration project review and analysis Application Development and Migration Software licenses Education and Training Custom Services

Pilot project Migration phase project Business integration and re-engineering project Operational and deployment services project And much more

The NewCode Service Partners:

Virtusa Corporation IndigoCube IBM GBS

Migrating Visual Basic Applications to VB.NET with the NewCode extension for Microsoft Visual Studio September 2008 Part Number N224 Copyright © NewCode Technologies Limited 2008. All rights reserved. Printed in Ireland.

Information in this document, including website addresses (URLs) and other Internet references, is subject to change without notice and is provided for informational purposes only. Unless otherwise noted, the example companies, organizations, products, people, and events depicted herein are fictitious. No association with any real company, organization, product, person, or event is intended or should be inferred. NewCode Technologies Limited does not provide any warranties covering this information and specifically disclaims any liability in connection with this document. NewCode might have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from NewCode, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Visual Studio 2005, Visual Studio 2008, Windows Server 2008, Windows Vista and SQL Server 2008 are trademarks of Microsoft Corporation. All other mentioned products or company names are used for identification purposes only, and may be trademarks of their respective owners.

E-Mail: [email protected] Web: www.NewCode.com