Roslyn: Convert C# to VB

烂漫一生 提交于 2019-12-04 10:49:01

I developed an application 7 years ago in VB.NET and I had to integrate a component into it whose SDK was written in C# only. The application that I had to integrate was reasonably large amd complex. I used this product to convert the C# to VB.NET and whilst the finished product did require some tweaking and some thorough testing, I don't recall the process being particularly harrowing. The outcome was excellent. The application worked well and it is still going strong today.

http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_VB.html

InteXX

FYI there is now a Roslyn Code Converter add-in for Visual Studio 2015.2+:

https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.CodeConverter

The web version is here and the repo is here.

SharpDevelop has a menu doing that conversion for the entire project. You can automate it interacting with the GUI (simulating mouse clicks) or, since it is open source, you can find the method called to do the conversion and call automatically with a special command line argument you can add and pass to SharpDevelop. P.S.- That's the way developerfusion does the conversion (you can see in "Known Issues" a clear reference to #develop).

I use the online tool http://www.developerfusion.com/tools/convert/csharp-to-vb/ This seems to handle whole classes without an error.

You don't compile to VB. Languages used by the .NET Framework compile to CIL code, which you could decompile to VB.NET. The results would be ugly.

Instead, use a conversion tool. Your sample code gave me this:

Namespace TestApplication
    Class Class1
        ''' <summary>
        ''' Lorem
        ''' </summary>
        Public Sub Lorem()

        End Sub
    End Class
End Namespace
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!