VB.NET Compatibility Check

Enterprise Edition only

Is your VB6 code ready for Visual Basic .NET? Review your project before attempting to migrate it. The VB.NET Compatibility Check feature reviews existing VB6 code to find incompatibilities with VB.NET.

  1. Evaluate the amount of upgrade work.
  2. Stay alert about features or projects that can't upgraded at all.
  3. Prepare your code for the upgrade. Save work and reduce errors.
  4. Upgrade the prepared project with a minimum amount of hassle.

VB.NET Compatibility Check detects incompatibilities between VB6 and VB.NET, using the Visual Basic Upgrade Wizard as a reference point. This is the wizard that comes with Visual Studio 2008. To upgrade to a newer VB.NET version, one can use the 2008 wizard and load the resulting project in a newer Visual Studio.


How to run it?

  1. Run Project Analyzer.
  2. Click Options|Problem options and select <VB.NET Compatibility> or <VB.NET Fix before upgrade> as the problem filter.
  3. Analyze a VB6 project or project group.
  4. Get a VB.NET compatibility report in the Enterprise menu.
  5. See the problem list in the main window for compatibility issues.
  6. Fix the issues that can be fixed before the upgrade.
  7. Import your project to VB.NET.
  8. Continue your upgrade work based on the upgrade report given by Visual Studio.

How VB.NET Compatibility Check can help you

Old code won't run in Visual Basic .NET without modifications. The Upgrade Wizard automates a part of the process. To make it run better you need to be prepared in advance. If you plan to move to VB.NET now or later, make sure your code is compatible with it. Prepare your declarations and syntax. Fix your form design. Plan data structures. Here is how Project Analyzer can help:

  1. Decide whether to upgrade or not. There are program types that are best left in your current VB version. Projects that use certain special techniques cannot easily be upgraded.
  2. Remove dead code. Start by deleting all the code your programs don't use. It is not uncommon to have 30-40% dead code in a medium or large sized project. Migrating that code means extra burden and no benefits. Run auto-fix to delete unused code before going any further. This is often the biggest savings you can get.
  3. Remove duplicated code. Run find duplicate code and join any considerable duplicated blocks or procedures. This reduces the amount of code requiring rework.
  4. Upgrade problematic syntax and controls. Use of certain syntax can cause you a lot of trouble. Obsolete syntax such as GoSub needs to go. Prepare your conditional compilation (#If and #Else) so that all required lines are enabled at the time you're running the Upgrade Wizard.
  5. Fix your data declarations. If you've used a lot of Variants and undeclared variables, you're almost doomed. Now it's your final chance to add those Option Explicit statements and add proper type declarations to every Dim statement. Not only will this make your code more robust and optimized, it will also enable the upgrade wizard to properly port your code. Control object variable declarations are of special importance. In addition, certain array and user-defined type definitions are going to change. See the compatibility rules for details.

See also

Code review
Code review rules

Project Analyzer Help