[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

upgrade vb6 project with several dependancies to vb.net

I have a project in vb 6 that has 5 dependencies

each is also a vb6 project.

I need to upgrade everything to vb.net.

do I combine all into 1 project?

what is the best approach
1 Solution
Asim NazirCommented:

Try the upgrade solutions. Download and install this analyzer tool.

Go through this article for a detailed conversion strategy.
Jacques Bourgeois (James Burger)PresidentCommented:
Coming from 12 years of prior experience with VB6 and having now the same 12 years of experience with .NET, I can tell you that the best approach is to start from scratch in .NET.

Although VB6 and VB.NET have the same syntax, too many things are different to make conversion a good solution, unless you have a very simple project, which does not seem to be your case. .NET applications are not designed the same way. How you work with errors and databinding is very different. Many little things have no direct equivalent and need to be rewritten anyway. And a conversion does not use the extra possibilities of .NET, so you basically ends up with no gain at all. On the contrary, you end up with a buggy application that is most of the time slower than the original.

Most "real" projects I have seen converted through the converter ended up on the scratch pile after a few days, weeks or even a few months. And I am not talking about my own conversion projects, because I understood that after the first try. It comes from the hundreds of programmers that I meet each year in the VB.NET training sessions I give.

The result of a conversion is always a mess of code that no programmer would ever write. Experienced .NET programmers have often problems understanding that code because it does strange tricks in order to give in .NET the same result as it did in VB6. VB6 programmers think that they can learn from the generated .NET code, but you will learn nothing, because that is .NET code that emulates VB6, not true .NET code. Half of what it does is done through a Compatibility library that nobody uses when writing straight in .NET.

That code is buggy and hard to debugged because it is not clean .NET code. Not only will it be a pain to make the conversion work, but it will be a pain to maintain for as long as the application will be in use.

If your 5 dependencies are dlls for which you have the source code, you might have a way to go. Otherwise you will gain much by starting everything over in .NET. More work at first, but in the long run, it will pay with a more robust application that is easier to maintain, and you will learn to work properly in .NET.

You can start by rewriting only the application from scratch in .NET, and still use the dependencies as they are now. .NET can often work quite well with old dlls, unless they used the Variant datatype extensively. The Variant is no longer supported in .NET, and dlls that use them a lot usually do not work well with .NET applications.

Then, as the needs arise, rewrite each dependency in .NET, one by one.
hainansyndromeAuthor Commented:
The dependencies are DLL's
I just inherited this thing and although I will be rewriting this a lot I simply do not have the bandwidth to rewrite from scratch.
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Jacques Bourgeois (James Burger)PresidentCommented:
I suggest that you try running the converter on the main application. All you have to do is open the VB6 project in Visual Studio. This will give you a report of the things that need to be corrected. That will give you an idea of the amount of job you will still have to do after the conversion. Sure, this is something hard to evaluate if you do not have much experience in .NET, but it might help you figuring out if a conversion or a rewrite is the way to go.

And remember that a conversion might eventually work, but will be a mess that will be hard to maintain in the log run.

I understand that you do not have the source code for the dlls and cannot convert them to .NET. As I said before, they might work easily well the .NET application, but maybe not. It depends on how they were designed and the types they use. I would contact the providers to know if they have .NET versions or interop available for their COM dlls.

An interop is a bridge between .NET and COM and is something that you will need anyway. One will be created on the fly for you when you reference a COM dll in a .NET project. But these on the fly interops sometimes do not work well, so some vendors provide an interop that has been debugged and enables you to use the old dlls without problems.
hainansyndromeAuthor Commented:

all the dll's were written in vb6 by the original author, I have their projects.
Should I try to combine all the projects into 1 project?
Jacques Bourgeois (James Burger)PresidentCommented:
I would not try to combine them. There were probably reasons why the thing was develop in 6 parts instead of one big project.

And since you can first convert the application and test it with the old dlls, you will be able to see sooner if converting is a viable solution. If you do everything at once, it may takes you weeks before you have something that can run, and if you find out at that point that converting does not work, you will have lost a lot of time. This is the most typical conversion scenario I see, and it always fails.

You are lucky that the original programmer took the .exe with multiple .dll route. The only few conversions I have seen working in these 12 years were all designed that way.
In .NET, you can have many projects under same solution (cant remember if VS6 supported this) so you can keep all your projects separate but under a single solution.
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now