Detailed Instructions

There are three steps to using the command-line interface to C-Sharpener For VB (CSVB):

1.Create a config.xml file.
2.Launch the conversion.
3.Resolve any errors.

Step 1 - Create a config.xml file

C-Sharpener For VB reads a configuration file to determine what and how a project is converted. The file correlates closely to the options that you select with the user interface for C-Sharpener For VB. The file is slightly different depending on whether you have the Standard or Professional Edition.

Standard Edition Format

The conversion options available in the file generally correspond to the Select Standard Options Page.

Here is an example file for converting a GeneralGrammarTest windows application:

<?xml version="1.0" encoding="UTF-8"?>

<CSVBCommandLineConfig>

     <SolutionFile>C:\Projects\GeneralGrammarTest\GeneralGrammarTest.sln</SolutionFile>

     <SourceProject>

          <Name>GeneralGrammarTest</Name>

     </SourceProject>

     <DestinationProject>

          <Name>GeneralGrammarTest_CS</Name>

          <Location>C:\Projects\GeneralGrammarTest\GeneralGrammarTest_CS\</Location>

          <ConversionOptions>

               <IncludeSourceComments>true</IncludeSourceComments>

               <AddExplicitCasts>true</AddExplicitCasts>

               <AddSourceLineNumbers>false</AddSourceLineNumbers>

               <KeepIntermediateFiles>false</KeepIntermediateFiles>

               <SendStatistics>false</SendStatistics>

               <GenerateOverloaded>true</GenerateOverloaded>

               <GeneratePropertyMethods>true</GeneratePropertyMethods>

          </ConversionOptions>

      </DestinationProject>

</CSVBCommandLineConfig>

Here is an example file for converting a SimpleWebApp web application:

<?xml version="1.0" encoding="UTF-8"?>

<CSVBCommandLineConfig>

     <SolutionFile>C:\Projects\SimpleWebApp\SimpleWebApp.sln</SolutionFile>

     <SourceProject>

          <Name>SimpleWebApp</Name>

     </SourceProject>

     <DestinationProject>

          <Name>SimpleWebApp_CS2</Name>

          <Location>http://localhost/SimpleWebApp_CS2</Location>

          <ConversionOptions>

               <IncludeSourceComments>true</IncludeSourceComments>

               <AddExplicitCasts>true</AddExplicitCasts>

               <AddSourceLineNumbers>false</AddSourceLineNumbers>

               <KeepIntermediateFiles>false</KeepIntermediateFiles>

               <SendStatistics>false</SendStatistics>

               <GenerateOverloaded>true</GenerateOverloaded>

               <GeneratePropertyMethods>true</GeneratePropertyMethods>

           </ConversionOptions>

      </DestinationProject>

</CSVBCommandLineConfig>

 

Professional Edition Format

The Professional Edition contain the additional options beyond the Standard Edition. The additional conversion options generally correspond to the Select Professional Options Page. The additional conversion options are highlighted in bold.

Here is an example file for converting a GeneralGrammarTest windows application:

<?xml version="1.0" encoding="UTF-8"?>

<CSVBCommandLineConfig>

     <SolutionFile>C:\Projects\GeneralGrammarTest\GeneralGrammarTest.sln</SolutionFile>

     <SourceProject>

          <Name>GeneralGrammarTest</Name>

     </SourceProject>

     <DestinationProject>

          <Name>GeneralGrammarTest_CS</Name>

          <Location>C:\Projects\GeneralGrammarTest\GeneralGrammarTest_CS\</Location>

          <ConversionOptions>

               <IncludeSourceComments>true</IncludeSourceComments>

               <AddExplicitCasts>true</AddExplicitCasts>

               <AddSourceLineNumbers>false</AddSourceLineNumbers>

               <KeepIntermediateFiles>false</KeepIntermediateFiles>

               <SendStatistics>false</SendStatistics>

               <GenerateOverloaded>true</GenerateOverloaded>

               <GeneratePropertyMethods>true</GeneratePropertyMethods>

               <AddNewlineBeforeCurly>true</AddNewlineBeforeCurly>

               <EliminateDependenciesOnVisualBasic>true</EliminateDependenciesOnVisualBasic>                            

               <CommentDeadPrivateFields>true</CommentDeadPrivateFields>

               <AddCommentForMissingComments>true</AddCommentForMissingComments>

          </ConversionOptions>

      </DestinationProject>

</CSVBCommandLineConfig>

Here is an example file for converting a SimpleWebApp web application:

<?xml version="1.0" encoding="UTF-8"?>

<CSVBCommandLineConfig>

     <SolutionFile>C:\Projects\SimpleWebApp\SimpleWebApp.sln</SolutionFile>

     <SourceProject>

          <Name>SimpleWebApp</Name>

     </SourceProject>

     <DestinationProject>

          <Name>SimpleWebApp_CS2</Name>

          <Location>http://localhost/SimpleWebApp_CS2</Location>

          <ConversionOptions>

               <IncludeSourceComments>true</IncludeSourceComments>

               <AddExplicitCasts>true</AddExplicitCasts>

               <AddSourceLineNumbers>false</AddSourceLineNumbers>

               <KeepIntermediateFiles>false</KeepIntermediateFiles>

               <SendStatistics>false</SendStatistics>

               <GenerateOverloaded>true</GenerateOverloaded>

               <GeneratePropertyMethods>true</GeneratePropertyMethods>

               <AddNewlineBeforeCurly>true</AddNewlineBeforeCurly>

               <EliminateDependenciesOnVisualBasic>true</EliminateDependenciesOnVisualBasic>                            

               <CommentDeadPrivateFields>true</CommentDeadPrivateFields>

               <AddCommentForMissingComments>true</AddCommentForMissingComments>

           </ConversionOptions>

      </DestinationProject>

</CSVBCommandLineConfig>

 

Step 2 - Launch the conversion

Before you launch CSVB from the command-line, it is important that you understand some basic assumptions that CSVB makes:

1.CSVB assumes that the destination project name does NOT exist in the Solution before the conversion begins. You must remove the destination project from the Solution before you start converting.
2.CSVB assumes that the destination project location does NOT exist before the conversion begins. You must delete the project location (virtual or disk directory) before the conversion begins.
3.CSVB assumes that the current directory contains the configuration file. You must go to this directory before you type in the command.

To launch, open a command window and move to the directory that contains the configuration file. Assuming that the configuration file is GeneralGrammarConfig.xml, you would type the following and press the enter key:

 

devenv /command "VBTranslatorAddin.Connect.VBTranslatorAddin GeneralGrammarConfig.xml"

You should see Visual Studio display while the conversion is happening, but it will close automatically once the conversion is completed. Make certain that you are running the correct version of devenv if you have multiple versions of Visual Studio .Net installed.

Step 3 - Resolve any errors

If there are any errors that occur during the conversion, CSVB will create a ConversionError.txt file that you can open. If no errors occur, then no file is created.