paul1956 / CSharpToVB

New version of CSharpToVB converter
MIT License
26 stars 9 forks source link

languages:

C# to VB.Net Converter

Requires

License

Technologies

Topics

Release Download

https://github.com/paul1956/CSharpToVB/releases/C#ToVB5.0.7.0.zip

Updated

Description

This application will convert C# to VB while trying to preserve comments, formatting and as many Directives as possible. It converts the True side of conditional directives, the False side is not converted. After conversion it tries to compile the code. If a file can't be compiled it can be add to an ignore list so you can continue to process other files.

You can convert text by typing or pasting in into the left Window, a file, project or folder from the menu's.

The Tests under "TestCompile" are designed to translate the C# code in Roslyn and uses GetRoslynRootDirectory to find it. Results of folder conversion are stored in with the same directory structure with the root directory renamed to _VB. The original directories are unchanged.

This version required at least Visual Studio 2019 version 16.3.0 to compile the code it produces because it uses the new Visual Basic feature _ ' Comment to preserve most comments and formatting. To build the converter application, Visual Studio 2019 Version 16.11.9 or Visual Studio 2022 and .Net Core 6.0

Opening the resulting Visual Basic files in Visual Studio will further improve the formatting.

The last five files compiled are saved in an MRU list and you can save the edited Source windows into a Snippet and reload it. This is useful when you are debugging and want to focus on the lines that are a problem. You can search Input or Output buffers and hide the search options by clicking on the X. You can stop folder conversion with the Stop button. You can restart from where you left off by selecting the option "Start Conversion from last file" or start at the beginning by deselecting this option, if this version is selected and you switch to convert a new folder the application will immediately return done and you will need to deselect the option. You can show or hide line numbers from the View Menu.

Work to be done: There are several Stop statements for debugging, and if you continue past them reasonable things will happen but a better translation is possible.

Important Notes

https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json is added to NuGet Package Source to find Microsoft.Dotnet.XUnitExtensions which provides ConditionalFact and PlatformSpecific attributes used for testing.

Any changes to CSharpToVB application needs to change the version information in the project file AND in MyProject/AssemblyInfo.vb until Visual Studio is able to general file automatically for a WinForms application.

What's New in this release

New in 5.0.7.0/5.0.2.11 Fix issue Pattern matching issues #83, add tests Add dark icons for menus Minor updates for CodeStyle violations

New in 5.0.6.5/5.0.2.10 Fix crash in project conversion Update Icons

New in 5.0.6.4/5.0.2.9 Update NuGet Packages and use IsKind instead of Kind

New in 5.0.6.3/5.0.2.8 Fix Cy.yml file to use .Net 6.0 Fix Form1.Designer to set Me.TSFindLookInComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList and remove setting in Form1

New in 5.0.6.1/5.0.2.7 Fix Crash in VisitEventDeclaration also preserve comments in Event Handlers

New in 5.0.6.1/5.0.2.6 Fix for #80

New in 5.0.6.1/5.0.2.4 Fix search dropdown to not use Simple to prevent toolstrip from growing

New in 5.0.6.0/5.0.2.4 Update to use .Net 6.0 Fix Issue #81

New in 5.0.4.0/5.0.2.2

Not all cases may be covered for new features so please provide feedback

New in 5.0.0.22/5.0.0.14

Code Coverage

+------------------+-------+--------+--------+
| Module           | Line  | Branch | Method |
+------------------+-------+--------+--------+
| VB.CodeConverter | 85.3% | 78.04% | 94.81% |
+------------------+-------+--------+--------+

+---------+-------+--------+--------+
|         | Line  | Branch | Method |
+---------+-------+--------+--------+
| Total   | 85.3% | 78.04% | 94.81% |
+---------+-------+--------+--------+
| Average | 85.3% | 78.04% | 94.81% |
+---------+-------+--------+--------+