Migrate VB6 to .NET Core with VBUC 8.3

by John Browne, on Aug 19, 2020 5:00:00 AM

Man admires .NET Core ignoring .NET Framework in meme.

VBUC version 8.3 now supports .NET Core and is available for download today

There's a lot to unpack there, so let's get started. 

VBUC (Visual Basic Upgrade Companion) is, of course, our baby and the most used tool/solution to modernize VB6 (and ASP) code to .NET. Originally created (by us) for Microsoft to ship with .NET 1.0, the earliest versions were part of Visual Studio and allowed VB developers to open a VB6 project in VS and migrate it to VB.NET. 

Microsoft's gamble on .NET paid off hugely and over the ensuing years untold numbers of Visual Basic developers have used our technology to modernize VB6 code to either VB.NET or C#, joining the brave new world of managed code via .NET. 

What .NET brought to Windows development was a simpler, cleaner way to write Windows desktop (and web) applications compared to the original Win32 API and C++. The .NET Framework not only provided a rich set of functionality for application development, it greatly simplified application deployment by eliminating "DLL Hell" and allowing apps using different framework versions to co-exist nicely. For VB programmers, the new features in Visual Studio meant they could once again use a WYSIWYG UI designer (for Windows Forms), double click controls to write code behind, and do it all with either their beloved Visual Basic syntax or a new, simpler version of C++: C#. 

Why .NET Core?

Jump ahead to today and things have changed. Over the past 10 years or so, Microsoft has shifted their strategy from "Windows Windows Windows!"
as Steve Ballmer famously said, to more of a global citizen by actively supporting the open source approach to software. First it was better support for Linux, and then moving .NET to open source as .NET Core. Finally it was announcing that all future improvements would be in .NET Core, not in the Framework. 

The beauty of .NET Framework is that it works--and will continue to work--perfectly on Windows. 

The beauty of .NET Core is that it will work anywhere the .NET common language runtime (CLR) is available--currently on Windows, MacOS, and Linux. And because .NET is a native runtime--not an emulation layer--it will perform comparably to any other native executable on each platform.

Migrating from VB6 to .NET Core

With VBUC 8.3, you can just select the output target as .NET Core and the correct project file and dependencies will be created in your upgraded solution folder. The Upgrade options that are shown will be adjusted to account for .NET Core compatibility; most are available but not all are. For example, you can migrate your ADO.DB code to ADO.NET using System.Data.Common and some helpers but not with ADO.NET using SQL Client. Obviously some older 3rd party components won't have a .NET Core library available for you to import, so you'll have to either use COM Interop or find an alternative to those dependencies. Finally, .NET Core requires C#, not VB.NET, so that option will not be available when you choose the Core option.

Try it, you'll like it!

We've put all our sample code up in github for you to play around with. The Salmon King Seafood VB6 app will work with your trial version of the VBUC--why not use it to migrate some working VB6 code to both the .NET Framework and .NET Core and compare the two resulting apps? Remember to target C# for .NET Core and why not run it on a Linux VM if you have one? 

As always, let us hear from you with your questions, suggestions, and corrections. 

 

Topics:VBUC

Comments

Subscribe to Mobilize.Net Blog

More...

More...
FREE CODE ANALYSIS TOOL​