views:

514

answers:

3

I own a copy of vb2005 professional. I need to migrate a vb6 project to vb.net Is there any difference in terms of effort to migrating to these editions of vb.net thanks

+1  A: 

I'm rewriting a lot of VB6 currently and what I've found so far is that the previous developers had to use a lot of third party and custom modules to implement what they need when a lot of it has been included in the base class library for .Net since then.

From what I've seen there's no easy way to migrate from one to another. A lot of effort goes into these migrations. The best thing to consider is whether you want to try to go line by line or examine the code, document core functionality, evaluate how well the software has worked over it's lifetime and then engineer a new design.

That's what I've ended up doing because a line for line rewrite is nearly impossible and a large pain. Compiling libraries and modules into COM to bring the functionality into .Net applications is a lot of effort and kind of a "McGyver" approach. That's why I just documented everything well, understood the process, then wrote as .Net software.

Specifically, what functionality are you trying to maintain? Have you written in .Net before?

jlafay
Yes I was hoping a lot of the need for workarounds would diminish with later versions.I want to maintain all functionality and this project needs ongoing development into the future. A large part of the motivation to migrate comes from a desire to learn/use a newer toolset. OTOH it's a bit big (140 kloc) for a total rewrite. I'm hoping to migrate one file at a time starting with the file that doesn't reference any other and get the code to at least compile before moving to the next file. I hoping the upgrade tool will do a lot.
bosco
Thats a good approach to start with, good luck with your project. If possible I would start with a smaller project or some code demos to learn .Net rather than a large rewrite like that. If the software still serves its purpose and doesn't need to be improved then I would leave it be. Thats just my opinion. Why rewrite something 140k lines just to learn a framework?
jlafay
jlafay's comment is right. Microsoft's advice is to start with some small projects first before trying to migrate a large project. You can't do a good migration without learning the framework first.
MarkJ
A: 

In my experience the "migrate" is really a rewrite so it doesn't make any difference what version of Visual Studio you use. I'd use the latest.

Kevin Gale
Only thing though, is that vb2010 doesn't have an upgrade wizard.
bosco
+1  A: 

I think it's slightly easier to target the later versions. I believe the PowerPack 3.0 was added for Visual Studio 2005: it included extra support for emulating the VB6 Printer object and shape controls.


Anyone who's read my other answers about VB6 migration should stop reading now because I've said this before... but I think it's relevant, so I'll say it again anyway.

Check out the Microsoft UK advice with a screencast explaining the 5 basic options for .Net migration. Decide which is best. People may advise you to just rewrite from scratch in .Net. Be cautious about this - you say your codebase is big, which is a danger sign for rewriting. Microsoft UK say

Performing a complete rewrite to .NET is far more costly and difficult to do well [than converting] ... we would only recommend this approach for a small number of situations.

MarkJ
Thanks MarkJ. Actually I'm actually quite encouraged with progress so far. I was able to strip out 135 Klines, used the upgrade wizard on the remaining 6K approx and it compiled (with some warnings) right away!I then added a module that deals with printing and I'm going to have to do a bit of rewriting here as vb2008 doesn't like the hdc property of the printer. I figure one file at a time and this is looking doable! I'm disappointed though that printing looks to be, if anything, even more of a PITA in vb.net than vb6 though.I'm using vb2008 express as vb2010 doesn't have an upgrade wizard.
bosco
@bosco. Are you saying you were able to remove 135 Klines of unnecessary code? Wow! The remaining task does sound doable: upgrading a 6 Kline program that compiles after the upgrade wizard. Good work!
MarkJ
No!! :) All calls to forms are done via functions in a "Junction" module. eg Public Sub FormFooCall(byVal Action as string) Action = UCase(Trim(Action) If Action = UCase(Trim(("Visible = True")) then ReferenceFormFoo0: frmFoo.Visible = True end if End Sub So by commenting out all instances of ReferenceForm in this module all forms in the project are commented out except the StartUp form and the project will still compile in vb6. Once the forms are gone any module can be removed as they are only referenced from the forms So I still need to stick them all back in!
bosco
Cant seem to get the code to indent here
bosco
@bosco Ah. In that case I still recommend you have a look through the Microsoft advice in my answer. There's several different routes to migrating, and upgrading everything through the wizard in one go (as you are doing) is only one option. For example you could split the original VB6 project into components and upgrade the components one at a time. That allows you to do the task piecemeal.
MarkJ
Thanks MarkJ, have decided to migrate to vb2008 with the help of the built-in upgrade wizard. I wasn't expecting much from it based on what I've read but for my code at least I'm finding it a pretty decent help.
bosco