VB6 to .NET Migration: Strategies, Challenges, and Relevance
Tags: dotnet, vb6, webdev, community
Published: 2022-07-28 14:20:13

Visual Basic was created by Microsoft in 1991 and rapidly became popular. The event-driven coding language allowed engineers to modify code parts by simply dragging and dropping objects. 

However, today most applications built on Virtual Basic are migrated to the .NET framework. But what is it about the programming language that makes the migration so necessary?

## What is Virtual Basic?

Virtual Basic is an object-oriented, event-driven programming language first introduced in 1991. It features simple syntax, which makes it a perfect environment even for inexperienced engineers.

Virtual Basic by Microsoft is a so-called RAD (Rapid Application Development system). It is often used to design simple prototypes, which are later rewritten to be more complex and efficient.

## Why migrate Virtual Basic 6.0 to .NET framework?

The final VB version was released in 1998. In 2008, VB’s support was discontinued. 

What does this mean for companies that have internal applications built with Virtual Basic?

Today, companies still using Visual Basic 6.0 IDE are forced to migrate internal applications, because the programming language is no longer supported. An option that’s still available to those companies is migration to the .NET framework.

There is no completely accurate strategy to migrate from VB6 to .NET. Such a complex process involves major manual rewriting and should be done by professionals with expertise in .NET.

## Virtual Basic security vulnerabilities 

If you’re still using Virtual Basic, you should be aware that it might unexpectedly stop running. It’s support, identified as low priority, is not verified extensively.

In 2019, a BlueKeep security vulnerability was found in the Microsoft RDP. Soon after, a patch was released, but it broke the core functionality of the programming tool. The issue is addressing Windows 10, Windows 7, Windows 8.1, and corresponding server versions. Regardless of the cause for the emerged problem, this issue is a good reason to stop deploying the released patches.

It took several days for the Microsoft Corporation to address the BlueKeep security vulnerability. Users were left with two options – don’t run VB-based applications or don’t install any BlueKeep-related updates and be highly susceptible to viruses.

At the same time, both the US National Security Agency and Microsoft stated that BlueKeep attacks are similar in scale to the WannaCry ransomware. The malicious WannaCry virus encrypted the user’s whole hard drive and demanded a ransom in bitcoins.

## .NET framework migration strategies 

Those companies still using VB6-based solutions have the choice between three options: Extension, migration, and rewriting. Let’s dive deeper into this topic.

**Application extension**

This strategy is most suitable if:

- The application is working.
- The described above issues are acceptable. 
- New features have to be developed with fewer resources allocated.

Using .NET, additional modules can be easily implemented. The engineers can leave the legacy as is, but extend it with extra features. Old modules that are still relevant can be also migrated to .NET. This is the so-called “strangler” pattern.

The main pros of application extension:

- It is the most cost- and time-efficient approach.
- The application is being extended gradually, what means instant benefits from investments.

The cons:

- The VB6-based application parts are prone to vulnerabilities.

**Application migration**

This option is best for you in case:

- The application is unstable.
- The frequently emerging errors are affecting the overall user experience and causing data loss.
- All internal business processes are attuned to the desktop experience.

The main pros of application migration:

- The similarity of platforms allows preserving the usual user experience.
- The application is free from vulnerabilities.

The cons:

- Poor VB6 architecture choices might be automatically inherited from the original code.

**Application rewriting**

Turn to this strategy in case:

- The migration is done from the legacy desktop VB6 application to web or cloud.
- You want to extend market share.
- The application is outdated and does not cover your core business needs.

The main pros of application rewriting:

- It’s the only way to go when transitioning from desktop to web and mobile.
- Architecture written from scratch using today’s modern approaches provides for cheaper development and makes support expenses more reasonable in the long run. 

The cons:

- This strategy requires bigger initial investments than the two previously mentioned approaches. However, it is justified by the future benefits.
- Rewritten functionality must be extensively tested.

## VB6 to .NET framework migration challenges

- Application migration requires understanding of the legacy code as well as the target environment
- App migration is a cost- and time-consuming project
- There might be issues with compliance when rewriting separate parts of the legacy code
- There are data limitations that need to be considered before the migration

## Some steps to consider before migrating

**Application assessment** 

Perform a thorough assessment of the source code. Cleaning up before migrating saves time and costs that can be allocated to important operational processes. 

**Implemented third-party controls check**

Commonly, most of the extra controls built-in in VB6 applications aren’t compatible with the .NET ecosystem. Continuing using those controls might decrease the application’s overall performance and speed.

**Project planning**

Before migration, determine your project’s scope and assemble both legacy and application being developed. Detail the functional requirements, get the necessary tools, and choose a reliable tech partner.

**Choosing a suitable strategy based on business needs**

VB6 to .NET migration, depending on the core business needs, can be performed using different strategies. Before migrating, you have to choose whether to:

- Extend the app’s functionality
- Migrate
- Rewrite

**Data migration**

The engineers will have to migrate collected data by creating a database and resizing its structure to ensure high performance. 

**Quality assurance**

At least one third of all project resources should be allocated to quality assurance and fixing emerging errors.

## Important things to remember before migrating

- Migrate to functional equivalence

If you have made the decision to migrate your application, there is significant value in the application’s logic. Since you might depend on it, it is very important to leverage the investments already made.

- Decide on how to validate the functional equivalence

The project should have measurable criteria to validate the results. In our team’s experience, the best option is to prepare test cases to run first on the legacy and then on the new application to validate the migration.

## Final thoughts

Business growth demands scalability, and companies all around the globe are going web, mobile, and cloud. These all are either very expensive or even completely impossible when using Virtual Basic.

VB6 to .NET migration is necessary for those who want to stay highly competitive on the demanding market. The modern .NET framework is cross-platform, flexible in deployment, easy in maintenance, and cost-efficient. 

Application migration is a complex project, which demands both source and target platform understanding.