Mobilize.Net Visual Basic Upgrade Companion v9.3.10311.0
Mobilize.Net Visual Basic Upgrade Companion v9.3.10311.0
The Visual Basic Upgrade Companion (VBUC) converts your VB6 code to C# and VB.NET. Endorsed by Microsoft, VBUC generates 100% native code without third party runtimes and dependencies. VBUC reduces the amount of manual coding and generates a native .NET application that is equivalent to the original VB6 system.
Mobilize.Net has technology, support and services to help you rapidly migrate your VB6 code to .NET. The Visual Basic Modernization Accelerator Program converts 95% of your code -- combined with Mobilize.Net migration experts you are guaranteed a successful migration.
The Visual Basic Upgrade Companion (VBUC) includes powerful features & customization/extensibility options that help you move your code to C# or VB.NET.
VBUC dramatically reduces the amount of manual work and produces native .NET code.
The translated application will compile and run with equivalent behavior to the original VB6 system. VBUC outputs native code so you have no dependencies on third party runtimes. Even better, the code quality is so high that your teams will find it very easy to maintain the generated .NET code.
The Upgrade Wizard is a migration tool that ships with Microsoft Visual Studio .NET 2003, 2005 and 2008 platforms. This tool was specifically designed to assist in the upgrade process from Visual Basic 6.0 to Visual Basic.NET. It partially automates the migration from VB6 to VB.NET by performing the refactoring needed to adapt most of the simplest expressions and commands found in Visual Basic 6.0. It also contains mappings from inherent VB6 libraries to .NET compliant equivalents. So it’s basically a tool used to sketch the path to follow while upgrading from VB6 to VB.NET, working as an assistant to demonstrate all the challenges during the whole migration process. This way, the programmer will know where all the hardest spots while moving to the .NET framework are. Beside the issues identification, the Upgrade Wizard applies some automated translations over the VB6 code, reducing the time needed for the upgrade process by generating target source code.
Alternatively, the Visual Basic Upgrade Companion (VBUC) is a significantly more powerful migration tool, also dedicated to upgrade Visual Basic 6.0 applications to the .NET platform. To start with, the VBUC is able to generate C# source code as well as VB.NET. In the end, the Visual Basic Upgrade Companion’s architecture, scope, and target audience are very different from the Upgrade Wizard’s.
(Note: You can read more on the conceptual differences between the Visual Basic Upgrade Companion and the Upgrade Wizard at the VB to .NET FAQ. Or keep reading this page for some specific differences between both upgrade tools.)
The Upgrade Wizard is a valuable tool for VB6 to .NET migration projects; however, there are several areas where the upgrade process can be dramatically improved. Mobilize believes that many more code conversions can take place automatically through the use of artificial intelligence, to greatly reduce the time and cost of any given migration project, and here is where another main feature of the Visual Basic Upgrade Companion kicks in: this tool not only offers additional standard functionality but also excels in terms of customization. It has the ability to be customized according to your needs, increasing even more the percentage of automation of your Visual Basic 6.0 to .NET migration project.
Long time ago, Mobilize realized the market required a tool capable of handling larger, more complex migration tasks, with all the implications this carries. Therefore, the Visual Basic Upgrade Companion was conceived, incorporating the vast experience acquired by ArtinSoft during years of successful migration projects.
One of the most common questions is how much effort will the Visual Basic Upgrade Companion be able to reduce compared to the Upgrade Wizard? There is no standard answer, since it depends on the characteristics of each application to be migrated. Some data from real projects may be useful to shed some light on the subject, but the precise numbers for each case can only be obtained after an analysis of the VB 6.0 code and the customer’s target requirements. For example, using the VBUC on a 600,000 LOC application allowed one of our customers to save 15,000 hours. And that was using an older version of the standard tool, that is, without any customization. Plus a comparison between both tools cannot be based only on how much code does each converts automatically from VB6 to VB.NET, or the percentage of migration automation, but also on the quality of the resulting code. As you will read in the last chapters of this document, the Visual Basic Upgrade Companion does further code analysis to detect patterns that can be upgraded to be more .NET-like native structures, making the output more readable and maintainable.
But let’s start with some of the productivity enhancements the Visual Basic Upgrade Companion has vs. the Upgrade Wizard that will simplify your Visual Basic 6.0 to .NET conversion experience. You can read more about these and many other features on the Visual Basic Upgrade Companion page.
C# Generation: The Visual Basic Upgrade Companion is able to generate C# directly from the Visual Basic 6.0 source code as an alternative to Visual Basic .NET. Since there are several differences between C# and VB6, the Visual Basic Upgrade Companion applies special transformations for C# syntax, C# language constructions, strict typing, event declaration and invocation, structured error handling, VB6 modules to classes, parameters (optional, default values, by-ref, out, paramarrays), lower bounds to Zero, array dims and redims, default instances for forms, classes and user controls, indexer properties, “with” statement, “return” statements, interfaces support for C#, case sensitive corrections, brackets generation for array access, variable initialization, and much more.
The Upgrade Wizard was designed to generate VB.NET source code only, meaning this tool is unable to generate any other .NET compliant language, including C#.
(Read more about the Visual Basic Upgrade Companion’s C# generation capability).
3rd Party Library Extensibility: The Visual Basic Upgrade Companion can be customized so its core functionality is extended to satisfy your specific VB6 to .NET migration needs. This feature allows you to automatically upgrade your specific programming patterns, to add some new functionality on the upgraded application, and to upgrade the ActiveX controls that you have in the original application to .NET Framework components or newer versions of those specific third-party controls.
The Upgrade Wizard cannot be customized at all.
(Read more about the Visual Basic Upgrade Companion’s 3rd Party Library Extensibility).
Custom mappings: The Upgrade Wizard that ships with Visual Studio .NET contains a series of maps for intrinsic VB6 libraries to be upgraded into .NET constructions. These mappings are embedded into the application’s core and can’t be neither modified nor extended.
The Upgrade Wizard that ships with Visual Studio .NET contains a series of maps for intrinsic VB6 libraries to be upgraded into .NET constructions. These mappings are embedded into the application’s core and can’t be modified.
The Visual Basic Upgrade Companion features a user-customizable mapping engine. This means the user can specify particular transformations for element occurrences in the original VB6 code, so that they can be converted (mapped) into specific library elements, intrinsic or 3rd party.
Creating personalized mappings to handle conflictive or particular elements can enhance the overall upgrade process precision.
(Read more about the Visual Basic Upgrade Companion’s Custom Maps Extensibility).
Legacy Data Access Model to .NET: The Visual Basic Upgrade Companion migrates the VB6 data access models (ADO, RDO, DAO, ADOR) to .NET equivalents, employing special transformation rules and helper classes (for some specific source/target combinations). On the other hand, the Upgrade Wizard generates a target application that still uses those legacy data access models to communicate with the database via COM Interop wrapper calls.
(Read more and see some code samples about the Visual Basic Upgrade Companion’s legacy data access model to .NET functionality).
Structured Error Handling: The Visual Basic Upgrade Companion includes features to remove unstructured “spaghetti” code and replace it with structured flow control statements in .NET. All unused labels are removed from the resulting code. Plus the most commonly used “On Error ” patterns are currently recognized and replaced by the tool.
Meanwhile, the Upgrade Wizard migrates the application using the same “On Error” statement patterns that Visual Basic 6.0 uses for error handling. The Visual Basic Upgrade Companion generated code is easier to understand and conforms to the coding standards used when programming with .NET languages.
(Read more and see some code samples about how the Visual Basic Upgrade Companion supports structured error handling).
Type inference: An Artificial Intelligence-based type inference engine has been incorporated into the Visual Basic Upgrade Companion, which can infer the most appropriate data types for variable parameters and return values, avoiding the use of "generic" data types (i.e., Object). When an Object or Variant variable is found, the Visual Basic Upgrade Companion declares the variable with the appropriate type and avoids unnecessary Errors, Warnings and Issues (EWIs) during the Visual Basic 6.0 to .NET process. Thus, by following the type inference approach, the amount of manual work required to check for Upgrade Warnings is drastically reduced.
On the other side, the Upgrade Wizard employs generic data types (object) and has no type inference functionality.
(Read more and see some code samples about the Visual Basic Upgrade Companion’s type inference functionality).
.NET Native Libraries: Instead of upgrading VB6 code using the Visual Basic Compatibility Libraries like the Upgrade Wizard does, the Visual Basic Upgrade Companion promotes the use of .NET native libraries whenever possible.
There are several functions that when converted by the Upgrade Wizard, still rely on the Visual Basic compatibility library. Once again, this does not mean that your code will not compile; however, your code will be better off using the native libraries that the .NET framework offers. By using native libraries, you are making your code easier to read, easier to maintain, and in some cases, you will be improving the performance of the application.
(Read more and see some code samples about how the Visual Basic Upgrade Companion converts from VB6 to .NET native libraries).
.NET Enumerations: Another important Visual Basic Upgrade Companion feature, absent in the Upgrade Wizard, is the replacement of numeric literals assigned to several control properties with .NET enumeration equivalents when possible, so that the generated Visual Basic .NET code is more legible and maintainable.
Multi-Project Conversion: The Upgrade Wizard is able to convert one single VB6 project file (*.vbp) at a time. Hence, if the user wants to upgrade a complex VB6 application with this tool, several considerations must be taken in order to accomplish full functional equivalence.
The Visual Basic Upgrade Companion allows the conversion of multiple Visual Basic 6.0 projects. It performs a separation between the pre-processing and migration stages in order to fix problems like the use of by-ref parameters, interfaces, renaming and typing among the different projects. The pre-processor environment solves the references among projects and simplifies the overall migration process, because those references included in the solution will be calculated and there will be no error messages or warnings about missing members.
(Read more about how the Visual Basic Upgrade Companion supports VB6 multi-project conversions).
User declarations advanced refactoring: The Visual Basic Upgrade Companion manages all the user declarations to perform tasks such as recognizing conflictive user-declaration names to assign new denominations to the faulty identifier and all of its references.
These tasks improve the resulting source code readability and hasten the manual change stage.
The Upgrade Wizard is able to detect some naming issues found during the upgrade process and applies a simple renaming, but it is not able to refactor the resulting code to comply with .NET naming convention standards.
Visual Basic Upgrade Companion vs. Upgrade Wizard in terms of quality of the generated code
As you saw from the features described above, another big difference between the Visual Basic Upgrade Companion and the Upgrade Wizard is the quality of the code generated by each tool. Therefore, a comparison between both tools cannot be based only on how much code does each converts automatically from VB6 to .NET, or the percentage of migration automation, but also on the quality of the resulting code.
The Visual Basic Upgrade Companion does further code analysis to detect patterns that can be upgraded to more .NET-like, native structures, making the output more readable and maintainable. These improvements are separated in two large areas: data type enhancements and grammar pattern transformations and detailed code improvements.
Data type enhancements
Collections are upgraded to ArrayList or HashTable depending on their usage.
Integer to enumerate: when integers are used where an enum name is expected, the VBUC converts it to the corresponding VB6 enum field, and the maps it to the semantic equivalent in .NET.
IIF expressions: if the two expressions returned by the IIF have equivalent types, only one coercion is generated for the whole IIF invocation. Otherwise each expression is handled in the most appropriate way to make it match the expected type.
Several cases for conversions between types: objects to scalars (unboxing cases), dates vs. strings, arrays to arrays, fixed strings, octals and hexadecimals, etc.
Advanced transformations for arrays in most Dim and ReDim scenarios.
Integer data type variables can be optionally upgraded to Short or Integer depending on their arithmetical usage.
Enum Advanced conversions for:
- Enums in comparison operators.
- Enum values being transmitted as By-Ref.
- Coercions between Enums and other primitive data types.
Transformations for fixed size strings.
Grammar pattern transformations and detailed code improvements
New objects declarations including the initialization value.
Long "If..ElseIf" constructs are upgraded to the "switch" construct (“Select Case” in VB.NET), in order to improve performance and use better programming practices.
VBUC uses the "Return" keyword instead of the function name to set the return value within a function.
"For...Each" blocks are used instead of cycles that use iteration variables.
Initialization values for variables are moved to the variable declaration.
Typical nested "If" statements used in VB6 to produce short circuit evaluation are upgraded to a single "If" statement with short circuit evaluation operators (AndAlso and OrElse).