Section E.2. Command-Line Switches

   

E.2 Command-Line Switches

The VB.NET compiler supports the following command-line switches.

E.2.1 Output Filename and File Type

Switch

Description

 /out:<   file   > 

Defines the output filename. If not present, the output file will have the same root filename as the input file. <file> can be the root filename without a file extension.

 /target:   <type>   

or:

 /t:<   type   > 

Defines the type of file to be generated by the compiler. <type> can be any of the following keywords: exe (to create a console application), winexe (to create a Windows application), library (to create a library assembly in a DLL), and module (to create a .NETMODULE file that can be added to an assembly). If the switch is not present, type defaults to exe , and the compiler attempts to create a console application.

E.2.2 Input Files

Switch

Description

 /addmodule:   <file>   

Includes the .NETMODULE file named <file> in the output file.

 /libpath:<   path_list   > 

The directory or directories to search for metadata references (which are specified by the /reference switch) that are not found in either the current directory or the CLR's system directory. <path_list> is a list of directories, with multiple directories separated by commas or semicolons. Note that /libpath is additive; using multiple switches adds <path_list> to existing paths rather than replacing the existing ones.

 /recurse:<   wildcard   > 

Includes all files in the current directory and its subdirectories according to the wildcard specifications. For example:

 vbc /recurse:*.vb /t:library     /out:mylibrary.lib 

If you use the /recurse switch, you do not have to name a specific file to compile; however, if you do, it should not match the specification provided as an argument to the /recurse switch.

 /reference:   <file_list>   

or:

 /r:<   file_list   > 

References metadata from the assemblies contained in <file_list> . Each filename in <file_list> must include a file extension.

E.2.3 Resources

Switch

Description

 /linkresource:   <resinfo>   

or:

 /linkres:   <resinfo>   

Links to a managed resource file without embedding it in the output file. <resinfo> has the form:

   <file>   [,   <name>   [,publicprivate]] 

where <file> is the filename of the resource, <name> is the logical name used to load the resource, and the public and private keywords determine whether the resource is public or private in the assembly manifest. By default, resources are public.

 /resource:   <resinfo>   

or:

 /res:<   resinfo   > 

Embeds the managed resource or resources named <resinfo> in the output file. <resinfo> takes the form:

   <file>   [,   <name>   [,publicprivate]] 

where <file> is the filename of the resource, <name> is the logical name used to load the resource, and the public and private keywords determine whether the resource is public or private in the assembly manifest. By default, resources are public. The /resource switch cannot be used along with the /target:module switch.

 /win32icon:   <file>   

Indicates the application icon is found in a Win32 icon ( ICO ) file.

 /win32resource:   <file>   

Indicates resources are to be found in a Win32 resource ( RES ) file.

E.2.4 Code Generation

Switch

Description

 /optimize[+-] 

Determines whether compiler output is optimized to produce smaller binary files that offer improved efficiency and performance. Optimized code, however, is more difficult to debug. Its default value is on (+). /optimize is equivalent to /optimize+ .

 /removeintchecks[+-] 

Removesinteger overflow checks. Its default value is off (- ). Turning it on places the responsibility on the developer for ensuring that integers don't overflow their bounds. /'removeintchecks is equivalent to /removeintchecks+ .

E.2.5 Debugging

Switch

Description

 /debug[+-] 

Determines whether debugging information is generated and included in the output file or files. The default value is /debug- , which suppresses the generation of debug information. /debug+ or /debug causes the compiler to generate debugging information.

 /debug:full 

or:

 /debug:pdbonly 

Defines the form of debugging information output by the compiler. full generates full debugging information and allows a debugger to be attached to the running program; it is the default value if debugging is enabled. pdbonly generates a debug symbol (PDB) file only. It supports source-code debugging when the program is started in the debugger, but displays assembler only when the running program is attached to the debugger.

E.2.6 Errors and Warnings

Switch

Description

 /nowarn 

Disables warnings.

 /warnaserror[+-] 

Treats warnings as errors, so that warnings prevent the code from compiling. Its default value is off (-). /warnaserror is equivalent to /warnaserror+ .

E.2.7 Language

Switch

Description

 /define:<   symbol_list   > 

or:

 /d:<   symbol_list   > 

Declares global conditional compiler constants. <symbol_ list> has the form name= value , with multiple values separated by commas.

 /imports:<   import_list   > 

Globally imports namespaces, eliminating the need to define them with individual Imports statements. <import_list> is a comma-delimited list of namespaces.

 /optioncompare:binary 

Specifies binary (case-sensitive) string comparison; this is the default value. The switch does not override any explicit Option Compare settings found in individual source- code files.

 /optioncompare:text 

Specifies case-insensitive string comparisons. The switch does not override any explicit Option Compare settings found in individual source-code files.

 /optionexplicit[+-] 

Determines whether variables must be explicitly defined before they are used; the default setting is on. The switch does not override any explicit Option Explicit settings found in individual source-code files. /optionexplicit is the same as /optionexplicit+ .

 /optionstrict[+-] 

Determines whether implicit narrowing conversions and late binding are allowed; the default setting is off. The switch does not override any explicit Option Strict settings found in individual source-code files. /optionstrict is the same as /optionstrict+ .

 /rootnamespace:   <string>   

Defines a root namespace for all type declarations. This means that an Imports statement need not be used to import the root namespace, and that the relative path of a type (starting from the root namespace) can be used in place of its fully qualified name. Any Imports statements, however, must contain the fully qualified namespace name.

E.2.8 Miscellaneous

Switch

Description

 /help 

or:

 /? 

Displays help information.

 /nologo 

Suppresses the display of the compiler's copyright banner.

 /quiet 

Turns on quiet output mode; the compiler displays less information about errors than it does ordinarily.

 /verbose 

Turns on verbose output mode; the compiler displays more information about the file being compiled and about errors than usual.

E.2.9 Advanced

Switch

Description

 /baseaddress:   <number>   

Specifies the base address at which a library or module should be loaded. If a single application or component uses multiple libraries, or if modules are loaded by a single application or component, the runtime attempts to load them at the same address and then maps them to new addresses. In this case, performance can be improved by specifying the base address of a project's additional libraries or modules. <number> should be a hexadecimal address.

 /bugreport:   <file>   

Generates a file named <file> that contains information needed to report a bug.

 /delaysign[+-] 

If on (+), signs the assembly using only the public portion of the strong name key; if off (-), the default value, generates a fully signed assembly. The /delaysign option must be used with either /keycontainer or / keyfile .

 /keycontainer:   <string>   

Specifies a strong-name key container with the assembly's key pair. The name of the container is indicated by <string> ; if <string> has embedded spaces, it should be enclosed in quotation marks.

 /keyfile:   <file>   

Specifies the file containing a key or key pair that will be used to give an assembly a strong name. If the filename has embedded spaces, <file> should be enclosed in quotation marks.

 /libpath:<   path_list   > 

Specifies the list of directories to search for metadata references. By default, the global assembly cache is automatically searched for references.

 /main:<   class   > 

or:

 /m:<   class   > 

Specifies the class or module (or a class that inherits from System.Windows.Forms.Form) that contains Sub Main , which, if present, is a program entry point for applications and components . It is particularly useful if more than one class/module in a project has a subroutine named Main .

 /utf8output[+-] 

Emits compiler output in UTF8 character encoding, which is useful when local settings prevent compiler output from being displayed to the console correctly. Its default value is off (-). /utf8output is the same as utf8output+ .

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net