7

Would it be a good idea to start converting forms into .NET one at a time which you would then invoke from the VB6 app via COM-interop.

This way, by the end of the process you would just convert the 'shell' of the VB6 application into a new .NET app, and all your forms are ready to go in .NET.

Is there a better strategy?

MarkJ
  • 30,070
  • 5
  • 68
  • 111
Craig Johnston
  • 5,303
  • 8
  • 27
  • 30
  • In VB6, are you exposing any complex types through COM? Because these may be incompatible between VB6 and .Net. For example, if you use MSXML in VB6 you will want to replace it with System.Xml in .Net; this will only work if you do not use MSXML types in your COM layer. Same for ADO. – Polyfun Apr 27 '10 at 10:47
  • I'm still sifting through the code, but a guess I would say no. I put the VB6 through the VS2005 wizard and it came up with several thousand lines that didn't compile in .NET, so that is probably not an option. – Craig Johnston Apr 27 '10 at 11:21
  • There is however another service available which converts VB6 code to C#. SELISE Phoenix provides the service (fully functional converted code) and post conversion support to companies availing it. https://phoenix.selise.ch/ – Md Ashaduzzaman Aug 23 '20 at 13:30

5 Answers5

3

If it were me, I'd just rip the Band-Aid right off. I don’t see any benefit in having an in-between state [.NET Forms and COM-interop] for your application because it just adds unneeded complexity.

Robert Williams
  • 1,340
  • 9
  • 12
  • But I need the app to function perfectly for its users during the migration process. – Craig Johnston Apr 27 '10 at 11:18
  • What, are you migrating live systems? – M.A. Hanin Apr 27 '10 at 11:28
  • 2
    It is not feasible to deploy a new un-tested .net app. The risk of critical bugs is too great. The change must be more gradual. – Craig Johnston Apr 27 '10 at 11:52
  • 1
    Craig's right. A Microsoft insider has posted about how he tried to help some companies who were migrating to .Net through a big-bang approach, and many projects failed because the task was too big. http://blogs.msdn.com/goto100/archive/2008/11/03/rewrite-vs-migrate-vs-reuse-vs-replace.aspx – MarkJ Apr 28 '10 at 08:39
3

We have a VB6 application which is being ported to .NET either, and we use the COM-Interop strategy. All new features can be implemented in .NET, only the GUI-stuff remains VB; at the same time, we can develop a new GUI independently.

If you don't already know this, you can do COM Interop without using the registry (as this caused some problems for us) with Registration-Free COM Interop:

gammelgul
  • 3,450
  • 1
  • 20
  • 16
  • Some people recommend porting the GUI first. Why did you port the GUI last? – Craig Johnston Apr 27 '10 at 11:46
  • Actually, the idea was to port only some parts of the farly complex application in the first step and to create a silverlight application with the ported program logic. The VB6 application will remain for some time, but all newly developed parts can be used by the SL-app. – gammelgul Apr 27 '10 at 11:57
  • I read there are problems with using a .NET component in vb6 with reg-free interop. Did you have any problems with Reg-Free Com Interop between Vb6 and .NET? – Craig Johnston Apr 27 '10 at 12:14
  • The application was released to our customers some time ago, I haven't experiences any problems up till now. – gammelgul Apr 27 '10 at 12:23
  • There is however another service available which converts VB6 code to C#. SELISE Phoenix provides the service (fully functional converted code) and post conversion support to companies availing it. https://phoenix.selise.ch/ – Md Ashaduzzaman Aug 23 '20 at 13:31
3

There's lots of advice on strategies for conversion.

MarkJ
  • 30,070
  • 5
  • 68
  • 111
1

The piecemeal approach you describe will create extra work because you will be trying to get VB6 and .Net code to co-exist, which is fraught with problems on anything but the simplest applications. Somewhere down the road you are likely to trip over a gotcha which may be a showstopper.

I would recommend the following approach (based on successfully migrating a 600,000 line VB6 app to .Net):

Make sure your existing VB6 code base is properly version controlled and labelled. Write regression tests for your VB6 code base, preferably automated. Take a known VB6 code label baseline and migrate it as a single entity to .Net. Your customers continue to use the VB6 version. Run your regression tests on the migrated code. When all the tests pass, apply to the .Net code any VB6 changes that occurred since you took the original VB6 baseline. Deliver to UAT and then live.

Polyfun
  • 9,479
  • 4
  • 31
  • 39
  • +1 for writing from experience. Though I can imagine that the "apply to the .Net code any VB6 changes that have occurred" might be time-consuming on some projects – MarkJ Apr 28 '10 at 08:40
0

Would you do a large complex data conversion one-table at a time, with your systems using one, the other, or both data models concurently for an extended period? Clearly this is asking for trouble and complexity. Best practice for large data conversions is to do them in a way that brings the entire data model to its desired end state within the shortest possible outage. The same reasoning applies to large-scale code conversions. Doing them piecemeal over and extended period of time is asking for trouble in terms of increases labor costs and technical risk.

IMO, a better approach is to formulate the end-state development and architecture standards for your .NET code and then invest in a process that helps you efficiently rewrite your system in a way that conforms to those standards and accurately preserves legacy business rules and functional behavior. Long transitions and complex hybrid/intermediate solutions are only a stop-gap at best cause business problems and project failure at worst -- they should be avoided. A better approach will allow you to deliver the legacy software to the new platform in internally consistent, independent, and well-formed pieces. Furthermore, delivering the migration in fewer, larger pieces will be more efficient and less disruptive than many little pieces.

The key to making this approach viable is to use next generation VB6/COM/ASP to .NET tools that allow you to iteratively calibrate, customize, and verify an automated rewrite process that balances automated conversion with manual work. The tools from Great Migrations are specifically designed to enable this methodology. We call it the "tool-assisted rewrite". We have used this approach on several large migrations projects including upgrading an application portfolio of 1.2M LOC of VB6/COM to re-engineered C#/.NET.

Disclaimer: I work for Great Migrations.

Community
  • 1
  • 1
mark
  • 342
  • 2
  • 7