Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Convert VB Project to C# Project [closed]

I have a project written in VB, and I need to convert the whole project to C# project. I don't want to do it file by file, I found some online converters, but they convert only lines of codes, not the whole project. I found on researches, and here was written that I saw this question , there was written that

"The best part about Sharpdevelop is it converts the whole project (source files) from VB and C# and the other way"

And I also researched on Google, that if you Right Click on the project, I found here , that "Right click on the project in the Projects window and select Convert - From VB.NET to C#". But when I right click on The Project in the Projects window, I can'd find that "Convert". Is there any tool I have to install for SharpDevelop and then I will be able to convert my project ? Thanks

like image 857
Romo Daneghyan Avatar asked Aug 04 '14 06:08

Romo Daneghyan


People also ask

Can you convert VB to C?

The VB to C# code converter from the SharpDevelop team is now a standalone extension to Visual Studio. Once installed, you can convert an entire VB.NET project to C# by opening the solution, right clicking the solution node in the Solution Explorer and selecting Convert to C#.

Should I migrate from VB.NET to C#?

NET Core, you need to convert VB.NET to C#. If desktop apps are enough for you and your users, VB.NET works with NET 5, but only to target Windows Forms--not WPF. But if you want to write web apps running on ASP.NET Core, you'll need C#.

Can we use C# and VB in same project?

No, you can't. An assembly/project (each project compiles to 1 assembly usually) has to be one language.

Can we use VB class in C# project?

Yes. Because both VB.NET and C# compile into IL (intermediate language), you can simply create a library (a DLL file) in VB.NET, and then use that library in C#.


2 Answers

I am assuming you tried SharpDevelop 5 since the conversion feature was missing in that version.

The VB to C# code converter from the SharpDevelop team is now a standalone extension to Visual Studio. Once installed, you can convert an entire VB.NET project to C# by opening the solution, right clicking the solution node in the Solution Explorer and selecting Convert to C#.

like image 56
Matt Ward Avatar answered Oct 21 '22 14:10

Matt Ward


Sorry but I've not come across any tools that will convert the entire project. I've just created a interim c# project and converted small parts at a section at time, in the past. The conversion is not a straight one-2-one code map for a variety of reasons due to the differences in the languages. Small steps and some good unit testing help speed things up. Alternatively if your code uses code generators tools supplied by CodesmithTools, they often have compiler switches that will help change .net languages. This will definitely help in my humble opinion.

like image 4
Jamie Clayton Avatar answered Oct 21 '22 14:10

Jamie Clayton