Overview

The command line converter allows you to convert VB.Net projects, individual .vb files, a group of projects in parallel, and even a single line of code directly from the command line.  No gui will be displayed.

Program Location

The command line converter, vbtocscmd.exe, will be in the VBConversions program directory, typically C:\Program Files (x86)\VBConversions\VB.Net to C# Converter n.nn\.

Usage

vbtocscmd.exe [/?] input [conversion options] [output]

Brackets indicate optional parameters.  Don’t include [ ] around arguments.

Command Line Reference

There are four categories of command line parameters:

  • Help (displays command line parameters)
  • Input (vb code to convert)
  • Conversion options
  • Output (where to place C# output files)

 

Help

  • /? – This will display command line parameters.  If specified, all other parameters will be ignored.

 

Input

Input parameters specify the VB.Net code to convert.  Multiple may be specified.

  • Path\filename.vb – individual .vb files to convert (wildcards may be used)
  • Path\filename.vbproj – VB.Net project to convert (wildcards may be used)
  • Path\filename.sln – solution to convert (wildcards may be used)
  • /S – search subdirectories if wildcard is specified in path names above
  • /G: groupName – convert project group.
  • /L:”vb line”  – convert individual line of code (C# output to stdout)

 

Conversion Options

  • /V:2003|2005|2008|2010|2012|2013|2015 – VB.Net version to use when converting. Default is highest supported by computer for .vb files and single line conversions, and auto-detect for project conversions.
  • /P:integer – number of parallel processes to use when converting multiple projects.  Default is parallelism specified in program options screen.

Output

  • -O:outputDirectory – Used for .vb file conversions only, not projects, solutions, or groups, which use the target directory options in program options screen.

 

Examples

Example 1

Convert a VB.Net project to default target directory, auto-detect version number:

vbtocscmd.exe  d:\code\test.vbproj

Example 2

Convert all VB.Net projects in folder and subfolders using 8 parallel processes:

vbtocscmd.exe d:\code\*.vbproj /S /P:8

Example 3

Convert all .vb files in folder and subfolders.  Output files will be .cs in same directory as .vb files input.

vbtocscmd.exe d:\code\*.vb

Example 4

Convert d:\code\test.vb to d:\code\cs\test.cs using the VB.Net 2008 converter:

vbtocscmd.exe d:\code\test.vb /O:”d:\code\cs”