MonoBasic compiler Command-line options

by Johannes Roith (johannes@jroith.de)

Contents

Simple compile

Monos C# compiler is fully compatible the the MS compiler and has even the same switches.
// Hello World! : hello.vb

Imports System

Module Test
        Sub Main()
                Console.WriteLine ("Hello World!")
        End Sub
End Module



To compile, type
mbas hello.cs
This results in a file hello.exe, that you can execute with mono:
mono hello.exe

Out Parameters

To compile to another filename:
mbas /out:someothername.exe hello.cs

Using Targets

Exe

This is the default and will create a console application.
mcs /target:exe hello.cs

Winexe

This has no effect currently, when used with mono, but this might change, when mono will integrate with GUI filemangers like Nautilus. On the MS .NET Framework this causes the runtime not to open a console window, if not already opened.
mcs /target:winexe hello.cs

Library

to compile a library:
mcs /target:library hello.cs

Module

A module is not a complete application, but only for example one or two classes. Serveral module can be compiled to one application. This is useful if you want to compile one application out of a VB.NET module and a C# module.
mcs /target:module hello.cs

Other Options

  -? --help             Show this help list
     --about            About the MonoBASIC compiler
     --addmodule=PARAM  [NOT IMPLEMENTED YET]Reference metadata from specified module
     --baseaddress=PARAM [NOT IMPLEMENTED YET]The base address for a library or module (hex)
     --bugreport=PARAM  [NOT IMPLEMENTED YET]Create bug report file
     --checked          [Mono] Set default context to checked
  -d --define=PARAM     [NOT IMPLEMENTED YET]Declares global conditional compilation symbol(s). symbol list:name=value,...
     --debug            Emit debugging information
     --debug-args=PARAM [Mono] Debugger arguments
     --debug:full       Emit full debugging information (default)
     --debug:pdbonly    [IGNORED]Emit PDB file only
     --delaysign        [NOT IMPLEMENTED YET]Delay-sign the assembly using only the public portion of the strong name key
     --fatal            [Mono] Makes errors fatal
     --ignorewarn=PARAM [Mono] Ignores warning number PARAM
     --imports=PARAM    [NOT IMPLEMENTED YET]Declare global Imports for namespaces in referenced metadata files. import list:namespace,...
     --keycontainer=PARAM [NOT IMPLEMENTED YET]Specifies a strong name key container
     --keyfile=PARAM    [NOT IMPLEMENTED YET]Specifies a strong name key file
     --libpath=PARAM    [NOT IMPLEMENTED YET]List of directories to search for metada references (semi-colon delimited)
     --linkpaths=PARAM  [Mono] Adds path to the assembly link path
     --linkresource=PARAM [NOT IMPLEMENTED YET]Adds the specified file as an embedded assembly resource
  -m --main=PARAM       Specifies the Class or Module that contains Sub Main.It can also be a Class that inherits from System.Windows.Forms.Form.
     --noconfig         [Mono] Disables implicit references to assemblies
     --nologo           [NOT IMPLEMENTED YET]Do not display compiler copyright banner
     --nostdlib         [Mono] Don't assume the standard library
     --nowarn           Disable warnings
  -o --out=PARAM        Specifies the output file name
     --optimize         [NOT IMPLEMENTED YET]Enable optimizations
     --optioncompare:binary [NOT IMPLEMENTED YET]Specifies binary-style string comparisons. This is the default
     --optioncompare:text [NOT IMPLEMENTED YET]Specifies text-style string comparisons.
     --optionexplicit   [NOT IMPLEMENTED YET]Require explicit declaration of variables
     --optionstrict     [NOT IMPLEMENTED YET]Enforce strict language semantics
     --parse            [Mono] Only parses the source file (for debugging the tokenizer)
     --quiet            [NOT IMPLEMENTED YET]Quiet output mode
     --recurse=PARAM    [NOT IMPLEMENTED YET]Include all files in the current directory and subdirectories according to the wildcard
     --removeintchecks  [NOT IMPLEMENTED YET]Remove integer checks. Default off.
     --resource=PARAM   Adds the specified file as an embedded assembly resource
     --rootnamespace=PARAM [NOT IMPLEMENTED YET]Specifies de root namespace for all type declarations
  -r --reference=PARAM  References metadata from the specified assembly
     --stacktrace       [Mono] Shows stack trace at Error location
     --target=PARAM     Specifies the target type for the output file (exe [default], winexe, library, module)
     --timestamp        [Mono] Displays time stamps of various compiler events
     --tokenize         [Mono] Only tokenizes source files
     --unsafe           [Mono] Allows unsafe code
     --usage            Show usage syntax and exit
     --utf8output       [NOT IMPLEMENTED YET]Emit compiler output in UTF8 character encoding
  -v --verbose          Display verbose messages
     --warnaserror      Treat warnings as errors
     --win32icon=PARAM  [NOT IMPLEMENTED YET]Specifies a Win32 icon file (.ico) for the default Win32 resources
     --win32resource=PARAM [NOT IMPLEMENTED YET]Specifies a Win32 resource file (.res)
     --wlevel=PARAM     [Mono] Sets warning level (the highest is 4, the default)