Hamish Grubijan
Hamish Grubijan

Reputation: 10820

How to convert a vb.Net 4.0 project to C# 4.0 project?

I looked into:

http://www.developerfusion.com/tools/convert/vb-to-csharp/

as well as:

http://www.icsharpcode.net/opensource/sd/

but neither does exactly what I want.

EDIT:

The first link translates only the source code (.vb) and does a good job at it. I also need to convert the project.

The second link ... #develop does not handle .Net 4.0 projects.

So, that is why I said that neither does exactly what I want.

Upvotes: 1

Views: 559

Answers (1)

Matt Dawdy
Matt Dawdy

Reputation: 19707

Hamish -- I'm pulling out of the comment stream to answer the question directly. There doesn't seem to be a magic program, unfortunately. But the good news for you is that it is a relatively small program (400 lines of code in only 4 files).

So, if it were me, I would

  1. start a new C# project,
  2. add the 4 class files that you have,
  3. run them each through the VB->c# translator you linked to originally,
  4. dump the VB logging stuff and add in log4net
  5. turn the Windows Scripting stuff from VB into C# (I think your problem with this is that the translator above is flipping out on the types of WindowsScripting Host stuff)
  6. Compile and test.

With luck, this will take you a couple of hours. With bad luck, it depends on what the project actually does and that will determine how long.

I wish you good luck.

If you decide to go this route, be liberal about commenting out huge parts of code and compiling and working on eliminating compiling errors first. I'll try to keep an eye out to help you with any other specific questions that I see come across the front page.

Upvotes: 1

Related Questions