Visual Basic Compiler Options  

Visual Basic Compiler Options Listed by Category

The Visual Basic .NET command-line compiler is provided as an alternative to compiling programs from within the Visual Studio .NET integrated development environment (IDE). The following is a list of the Visual Basic command-line compiler options sorted by functional category.

Compiler Output

Option Purpose
/nologo Suppresses compiler banner information.
/utf8output Displays compiler output using UTF-8 encoding.
/verbose Outputs extra information during compilation.

Optimization

Option Purpose
/optimize Enables/disables optimizations.

Output Files

Option Purpose
/out Specifies an output file.
/target Specifies the format of the output file using one of four options: /target:exe, /target:library, /target:module, or /target:winexe.

.NET Assemblies

Option Purpose
/addmodule Causes the compiler to make all type information from the specified file(s) available to the project you are currently compiling.
/delaysign Specifies whether the assembly will be fully or partially signed.
/imports Imports a namespace from a specified assembly.
/keycontainer Specifies a key container name for a key pair to give an assembly a strong name.
/keyfile Specifies a file containing a key or key pair to give an assembly a strong name.
/libpath Specifies the location of assemblies referenced via the /reference option.
/reference Imports metadata from an assembly.

Debugging/Error Checking

Option Purpose
/bugreport Creates a file that contains information that makes it easy to report a bug.
/debug Produces debugging information.
/nowarn Suppresses the compiler's ability to generate warnings.
/quiet Prevents the compiler from displaying code for syntax-related errors and warnings.
/removeintchecks Disables integer overflow checking.
/warnaserror Promotes warnings to errors.

Help

Option Purpose
/? Displays the compiler options. This command is the same as specifying the /help option. No compilation occurs.
/help Displays the compiler options. This command is the same as specifying the /? option. No compilation occurs.

Language

Option Purpose
/optionexplicit Requires explicit declaration of variables.
/optionstrict Enforces strict type semantics.
/optioncompare Determines whether string comparisons should be binary or use locale-specific text semantics.

Preprocessor

Option Purpose
/define Defines symbols for conditional compilation.

Resources

Option Purpose
/linkresource Creates a link to a managed resource.
/resource Embeds a managed resource in an assembly.
/win32icon Inserts an .ico file into the output file.
/win32resource Inserts a Win32 resource into the output file.

Miscellaneous

Option Purpose
@ (Specify Response File) Specifies a response file.
/baseaddress Specifies the base address of a DLL.
/main Specifies the class that contains the Sub Main procedure to use at startup.
/recurse Searches subdirectories for source files to compile.
/rootnamespace Specifies a namespace for all type declarations.

See Also

Visual Basic Compiler Options Listed Alphabetically | <Projectname> Property Pages Dialog Box