如何将 VB 项目转换为 C # 项目

我有一个用 VB 编写的项目,我需要把整个项目转换成 C # 项目。我不想一个文件一个文件的做,我找到了一些在线转换器,但他们只转换代码行,而不是整个项目。我在研究中发现,这里写着 我看过 这个问题,上面写着

Sharpdevelopment 最棒的地方在于它可以将整个项目(源文件)从 VB 和 C # 以及其他方式转换过来

我还在谷歌上搜索了一下,如果你在这个项目上点击鼠标右键,我会找到 给你 “在 Projects 窗口中右键单击该项目,并选择 Convert-From VB.NET to C #”。但是,当我右键单击项目中的项目窗口,我可以找到“转换”。是否有任何工具我必须为 SharpDevelopment 安装,然后我将能够转换我的项目? 谢谢

104144 次浏览

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.

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#.