

Because of this, it’s recommended that you turn Option Strict On in the VB project. The main difference is that VB allows for dynamically typed variables (not to be confused with implicit types that C# supports). These can be dealt with either before conversion or after. Regular Expressions (I know, now you have two problems).įor large projects, I’d recommend spinning up a VM and running the conversions there, then pulling the branch down and fixing errors locally.Īlthough VB.Net and C# are very close cousins (syntax notwithstanding), there are a few key differences which will cause problems during conversion. Here’s a writeup on a few other options as well. VB Conversion Tool, from $50 per month or $495 for a perpetual license. People - If you’re more of a big picture kind of person, I’d highly recommend you find someone who is detail-oriented to assist with grinding through compiler errors, search and replaces, and (bonus points!) regular expressions. If absolutely necessary, you can begin new features by branching off of your conversion branch once it’s relatively stable.

Ideally, you’ll want to freeze feature development after you finish the automated conversion and begin fixing compiler errors. Scheduling - Make sure to afford ample time for this conversion in your project schedule. The more coverage you have, the easier it will be to find and resolve any issues after conversion. There are numerous tooling options - we use Cypress and Selenium. If you don’t have good coverage, this is a good excuse to make it happen.

Tests - I would highly recommend as comprehensive a set of automated UI tests as possible. dynamic types, implicit and explicit type conversions, anonymous types and the differences between VB and C#.
Convert c to vb.net on line code#
To sum up, we thought that we’d be equipped to write better code faster and more reliably in C# than in VB, both now and in the future. NET resources publish code, samples, and the like in C#. I am not a VB hater, but the future does not belong to VB.Īlthough Microsoft makes an effort to provide code samples in both C# and VB.Net, most other. Our team (and the workforce as a whole) has far greater experience and expertise in C# than VB.Net. This project was fair sized (3,000 files, 22K LOC), and we were able to complete the conversion in about 60 hours of time over a couple of months calendar time. With the right tools and know-how, it’s not terribly difficult or time-consuming. Seriously, wouldn’t you rather poke toothpicks in your eyeballs than convert a bunch of VB.Net code to C#? Maybe, but for us, there were several good reasons to tackle this: This wasn’t the sexiest project we’ve ever worked on, but a combination of good tooling, careful preparation, and a fair amount of mind-melting compiler error resolution made this one of our best remodeling efforts of 2018. Ben Johnson Converting a large VB.NET project to C#
