Reputation: 5561
I have a pretty old Visual Basic (.net 1.1) project that I'm willing to continue developing now, but not in Visual Basic but C#. Is there any way to convert it to C#? I can think of two options:
What is the recomended method to do this conversion?
Upvotes: 1
Views: 604
Reputation: 43046
Having just reread Joel's post that Jon Skeet mentioned, I would say do take his advice. Write a new C# project that references the old VB.NET project, and move code from the old project to the new project bit by bit, one class at a time. Every time you need to modify something, move the related code from the old project to the new project.
This should have some advantages:
Upvotes: 0
Reputation: 545588
For well-written VB 1.1, the online converters should do a decent job. I would try batch-converting the files of the project and then manually skimming them to look for obvious errors.
Online converters rather tend to choke on features that were introduced in more recent versions of .NET (for good reason – those features result in a much more fundamental code transformation during compilation, i.e. they make the languages more difficult).
/EDIT: But what Jon says has merit: .NET 1.1 is quite different, and in many ways inferior to, modern-day .NET, and an automatic conversion won’t help you adopting modern language and CLR features into the code.
Upvotes: 1
Reputation: 1500585
Given that .NET has changed pretty significantly since .NET 1.1 - and in particular, there are lots more libraries etc available which would change how you would approach various tasks - I'd be very tempted to just start again. Given that you'll already be changing .NET version and language, you'd be putting a lot of work in even just to get a direct port... so why not take the experience you learned from the existing project, and invest that into creating a new one?
(I'm aware of Joel's blog post on rewriting, but if you've already decided that you want a pseudo-rewrite by converting it to another language, I think some of that pain is inevitable anyway.)
Upvotes: 3