Adding references to Mobilize helpers source code (VB6 to .NET)
by Will Vasquez, on Sep, 06, 2019 @ 14:09
What are helper classes?
When you convert code from VB6 to .NET, some elements from the source application don't have a direct equivalent in the target platform. To bridge this gap Mobilize created some classes that have a native .NET implementation of the new way to achieve the same functionality you had in VB6.
Here's an example.
In VB6 you have the Recordset class, used to read/write/modify data in a database. The closest equivalent in .NET is the Dataset class. These classes have some important differences, like the fact that a Recordset has the concept of a position and the Dataset doesn't.
The helper classes have a RecordsetHelper class, which extends the functionality of the Dataset class in .NET and add properties and methods to replicate the behavior of the Recordset.
This approach allows the migrated code to remain clean of new variables and code structures that might make the code harder to read and maintain.
How are helper classes referenced?
The VBUC has two options to integrate these helper classes: Source Code and Binary.
The default option when targeting C# is Source Code and for VB.Net is Binary. This can be easily changed.
Since these classes have been tested in hundreds of projects, most of our clients prefer to keep the references as Binary, and not have extra projects in their generated application. For that, they select the Binary option and the migrated application will then add references to the helpers DLLs.
Changing from binary references to source code
Once you have executed the migration, and maybe spent some time completing the stabilization of the migrated application you might want to see what's in the helper classes, or maybe you feel that extending some of the functionality might be a good approach for what you're trying to do.
The helper classes can be then added manually to the solution.
The first thing you need to do is find the .zip file with the helpers. This is in the VBUC installation folder (typically C:\Program Files\Mobilize Visual Basic Upgrade Companion\Helpers).
Once you extract the contents of the zip file in a temporary folder, just locate the folders for the required helper projects (based on the references in the migrated solution) and copy them in the folder with your migrated code.
Now delete the references to the DLLs in the migrated project:
Then add the references to the recently copied projects:
And finally add the references to the newly added projects in the migrated project:
Now you can browse the code for the helper classes and modify it if you want to.