Convert a VB6 project to VB.net Visual Studio 2010

Are you having trouble converting VB6 project to VB.net Visual Studio 2010. Well just to be frank you should have long back converted this VB6 project of yours to VB.net. VB6 is ancient and just because your code works doesn’t mean that you won’t migrate it to a newer platform. In my opinion let your customers use the VB6 project of yours while you in the background should have converted a copy of it to VB.net. Now you might say it’s too much work… well how about it now. 😉

Just to be clear Visual Studio 2010 does NOT inherently support converting VB6 project to VB.net 2010. When I force a conversion (via project open dialog) I get the following error dialog…

VB6 to VB.net 2010 - Conversion Error

VB6 to VB.net 2010 – Conversion Error

Recently Mr. X asked me this question so I sent him an email with the steps on converting a VB6 project to VB.net Visual Studio 2010. So here are the steps (straight from the email I sent to the customer…)

  1. Make sure VB 6.0 with SP 6.0 installed on the machine.
  2. Make sure that all the referenced components (ActiveX dll, OCX) for the VB 6.0 application is available on the machine.
  3. Open the VB 6.0 project in VB 6.0 IDE and make sure that it opens fine. Build the project and make sure that the application executes without any errors.
  4. Run the Upgrade assessment tool on the visual basic 6 project:
    (Old one) http://www.microsoft.com/downloads/details.aspx?FamilyId=10C491A2-FC67-4509-BC10-60C5C039A272&displaylang=en
    (New one) http://www.artinsoft.com/visual-basic-upgrade-assessment-tool.aspx
  5. Keep a local copy of the VB 6.0 project
  6. There is no direct wizard conversion in Visual Studio 2010. You have to first use the conversion wizard available in Visual Studio 2005/2008 to convert to VB.net and then convert the same to Visual Studio 2010. As you don’t have Visual Studio 2008, you can download free version from following link.
    http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
  7. Once you are done with the conversion you can uninstall Visual Studio 2008 express edition.
  8. Also you can download a free guide which contains information about Upgrading Visual Basic 6.0 Applications to Visual Basic .NET and Visual Basic 2005 (Its bit old but it will give useful insights as and when you are migrating source code to .net).
    http://www.microsoft.com/downloads/details.aspx?FamilyId=7C3FE0A9-CBED-485F-BFD5-847FB68F785D&displaylang=en

A general note:

As per the upgrade guide, the effect of the changes and subtle differences in Visual Basic .NET is that, unlike previous versions of Visual Basic, most real-world projects cannot be upgraded 100 percent automatically. To understand why, consider that for a 100 percent upgrade there has to be a one-to-one correlation between every element of Visual Basic 6 and a corresponding element in Visual Basic .NET. Unfortunately, this correlation does not exist. The upgrade process is closer to 95 percent, meaning that the Visual Basic .NET Upgrade Wizard upgrades 95 percent of your application, and you modify 5 percent of the application to get it working. What does 5 percent mean? If it took you 100 days to write the original Visual Basic 6 application, you might expect to take 5 days to upgrade it. This number is not set in stone-some applications are easier to upgrade than others, and the experience of the person doing the upgrade is an important factor. To prepare yourself, make sure you familiarize yourself with Part IV of the upgrade guide. It discusses how to design your Visual Basic 6 applications to make the upgrade process much smoother.

Microsoft Visual Basic 6.0 Migration Resource Center
http://msdn.microsoft.com/hi-in/vbrun/ms788233(en-us).aspx

Appreciate your comments...