Application & Data Migration Blog Posts | Mobilize.Net

Best Practices for Migrating Your Legacy VB6 Application with VBUC

Written by Cheyenne Sokkappa | Dec 8, 2024 11:00:00 AM

Just getting started with using the Visual Basic Upgrade Companion (VBUC)?Here are some tips and best practices that can help you get started with your migration.

VBUC automates the migration from VB6 to a more modernized codebase in either C#/.NET or VB.NET. While the product gets most applications 95% of the way to the modernized version, we always account for variation in codebases and third party components or integrations that may require some manual work.

Here are some best practices to make the most of VBUC and utilize GAP Migrations resources to be able to make the most of your VBUC license:

Make A Plan

With the help of the GAP Migrations team, it’s important to make a plan for how you will upgrade your VB6 or ASP application to .NET. You will need to complete an assessment of the source code and determine the complexity of the application. This will help you decide what resources will be needed to allocate for the preparation, code conversion and testing/debugging and ultimately getting your application into production. This can be separated into 3 stages:

Application Preparation Stage
  • Install VBUC
  • A fully configured application development environment that corresponds to the application being upgraded
  • Application resource inventory (aka Assessment Mode)
  • Compilation verification, we want the original VB6 application in a correctly configured system
  • Project upgrade order definition: An analysis of dependencies that can be used to upgrade different components. 
  • Know the dependencies and limitations of the end environment you are upgrading to (aka understand the .NET environment in which your upgraded application will sit)
Application Upgrade Stage
      • Execution of the conversion with VBUC
      • A control step to verify the progress and correct execution of the upgrade
      • A corrective step to ensure that any issues arising during the upgrade are resolved
      • Complete the upgrade with any necessary manual changes
Application Testing and Debugging Stage
      • With the new .NET Application, you can now test a list of broken test cases and run time bugs detected in the application
      • Fix any runtime errors

Pre-Migration Tasks

Before you get started with uploading your code files into VBUC, there is some pre-migration tasks you can complete to help make the migration process a little easier. 

  • Code Cleanup: Code cleanup of your VBB6 code includes performing maintenance tasks on the code, removing code that’s no longer used, removing any redundant functions or methods and basic code or project restructuring
  • Code Preparation: Code preparation modifies the existing code to improve the quality of the generated code. 

Inputting high quality code to VBUC generates high quality .NET code as output. 

 

Utilize Assessment Mode

VBUC can collect important assessment information from the VB6 files. This can help you:

  1. Create upgrade solutions to solve pre-migration issues i.e. missing references or files.
  2. Create the assessment report to quantify the efforts required for the migration task.

We will get a list of resources and components involved in the upgrade process, including modules, third party components and intrinsic components. The assessment tool also identifies the dependencies between application components and analyzes different aspects of the code such as the application references, variable declarations and member accesses. 

Once you have completed an assessment of the source code, the tool can help the GAP Migrations team provide an estimate for the licensing and also the effort of the upgrade, whether or not you decide to buy a license only or enlist part of the GAP Migrations team to help you.

Be sure to maintain an upgrade procedure log

This document, the upgrade procedure log, includes the products of each upgrade step, component dependency relationships and the upgrade order. It ultimately provides you with a clear view of the process and allows you to plan and measure the effort required for future steps of the upgrade process. 

Conversion Best Practices

Now that your code is ready and prepared to go through VBUC and through the conversion process, here is what you can expect in the tool. You’ll go through the steps outlined in this article that can help you with using the tool: https://www.mobilize.net/vbtonet/vbuc-quick-start

Here are some ways you can expect the code to be modified in VBUC:

  • Language changes: The upgrade wizard transforms Visual Basic 6.0 code to use the new keywords and language structures introduced in Visual Basic .NET.
  • Core functions: References to Visual Basic 6.0 core functions are upgraded to equivalent classes and methods in the .NET Framework, when possible. When there are no equivalent .NET functions, or the upgrade wizard cannot determine the function to use, the wizard adds a note to the code file so you can fix it manually.
  • Forms: Visual Basic 6.0 forms and controls are upgraded to .NET Windows Form Controls equivalents.
  • Web classes: Visual Basic 6.0 Web classes are upgraded to .NET Web Forms.
  • Data: Data and connection objects are upgraded to Visual Basic .NET runtime callable wrappers (RCW) corresponding to data and connection objects. Upgrading these components to ADO.NET requires additional work.
  • User controls: Visual Basic 6.0 ActiveX user control components are upgraded to .NET user controls.

Manual Changes and Testing

Here are the basic steps you need to test the upgraded application:

  • Create a test plan and test code
    • This should have been done in the first step, a plan and estimate of the test efforts required to execute the tests
  • Create a test environment
    • Make sure you have all the tools and environments installed on your test environment to ensure success
  • Review the code
    • Validate that the implementation conforms to the design
    • Validate naming and commenting standards, performance and scalability guidelines and guidelines for writing secure code
  • Perform unit testing – white box testing
    • Unit testing is performed to make sure the behavior of a method in the upgraded component is the same as that of the corresponding method in the original VB6 version of the component
  • Perform black box testing
    • This simulated the end user experience and test the response of the upgraded application to end user actions. Conduct this testing to make sure the business logic of each end user component stays the same as the original application.
  • Perform profiling – white box testing
    • Profiling gathers statistical information about an application during runtime such as time and resource usage of an application and the execution tree exercise. This information can be analyzed to be optimized to improve speed or performance.

Other Resources

Check out our 10 Things to Know About VBUC:

 

Here are some of our top resources for helping you dive into more detailed migration best practices and guides:

 

Need any more help? Contact us!