.NET Framework 4.5
Vbc Task

Wraps vbc.exe, which produces executables (.exe), dynamic-link libraries (.dll), or code modules (.netmodule). For more information on vbc.exe, see Visual Basic Command-Line Compiler.

Parameters

The following table describes the parameters of the Vbc task.

Parameter

Description

AdditionalLibPaths

Optional String[] parameter.

Specifies additional folders in which to look for assemblies specified in the References attribute.

AddModules

Optional String[] parameter.

Causes the compiler to make all type information from the specified file(s) available to the project you are currently compiling. This parameter corresponds to the /addmodule switch of the vbc.exe compiler.

BaseAddress

Optional String parameter.

Specifies the base address of the DLL. This parameter corresponds to the /baseaddress switch of the vbc.exe compiler.

CodePage

Optional Int32 parameter.

Specifies the code page to use for all source code files in the compilation. This parameter corresponds to the /codepage switch of the vbc.exe compiler.

DebugType

Optional String[] parameter.

Causes the compiler to generate debugging information. This parameter can have the following values:

  • full

  • pdbonly

The default value is full, which enables attaching a debugger to the running program. A value of pdbonly allows source code debugging when the program is started in the debugger, but displays assembly language code only when the running program is attached to the debugger. For more information, see /debug (Visual Basic).

DefineConstants

Optional String[] parameter.

Defines conditional compiler constants. Symbol/value pairs are separated by semicolons and are specified with the following syntax:

symbol1=value1;symbol2=value2

This parameter corresponds to the /define switch of the vbc.exe compiler.

DelaySign

Optional Boolean parameter.

If true, the task places the public key in the assembly. If false, the task fully signs the assembly. The default value is false.This parameter has no effect unless used with the KeyFile parameter or the KeyContainer parameter. This parameter corresponds to the /delaysign switch of the vbc.exe compiler.

DisabledWarnings

Optional String parameter.

Suppresses the specified warnings. You only need to specify the numeric part of the warning identifier. Multiple warnings are separated by semicolons. This parameter corresponds to the /nowarn switch of the vbc.exe compiler.

DocumentationFile

Optional String parameter.

Processes documentation comments to the specified XML file. This parameter overrides the GenerateDocumentation attribute. For more information, see /doc.

EmitDebugInformation

Optional Boolean parameter.

If true, the task generates debugging information and places it in a .pdb file. For more information, see /debug (Visual Basic).

ErrorReport

Optional String parameter.

Specifies how the task should report internal compiler errors. This parameter can have the following values:

  • prompt

  • send

  • none

If prompt is specified and an internal compiler error occurs, the user is prompted with an option of wheter to send the error data to Microsoft.

If send is specified and an internal compiler error occurs, the task sends the error data to Microsoft.

The default value is none, which reports errors in text output only.

This parameter corresponds to the /errorreport switch of the vbc.exe compiler.

FileAlignment

Optional Int32 parameter.

Specifies, in bytes, where to align the sections of the output file. This parameter can have the following values:

  • 512

  • 1024

  • 2048

  • 4096

  • 8192

This parameter corresponds to the /filealign switch of the vbc.exe compiler.

GenerateDocumentation

Optional Boolean parameter.

If true, generates documentation information and places it in an XML file with the name of the executable file or library that the task is creating. For more information, see /doc.

Imports

Optional ITaskItem[] parameter.

Imports namespaces from the specified item collections. This parameter corresponds to the /imports switch of the vbc.exe compiler.

KeyContainer

Optional String parameter.

Specifies the name of the cryptographic key container. This parameter corresonds to the /keycontainer switch of the vbc.exe compiler.

KeyFile

Optional String parameter.

Specifies the file name containing the cryptographic key. For more information, see /keyfile.

LangVersion

Optional [String] parameter.

Specifies the language version, either "9" or "10".

LinkResources

Optional ITaskItem[] parameter.

Creates a link to a .NET Framework resource in the output file; the resource file is not placed in the output file. This parameter corresponds to the /linkresource switch of the vbc.exe compiler.

MainEntryPoint

Optional String parameter.

Specifies the class or module that contains the Sub Main procedure. This parameter corresonds to the /main switch of the vbc.exe compiler.

ModuleAssemblyName

Optional String parameter.

Specifies the assembly that this module is a part of.

NoConfig

Optional Boolean parameter.

Specifies that the compiler should not use the vbc.rsp file. This parameter corresponds to the /noconfig parameter of the vbc.exe compiler.

NoLogo

Optional Boolean parameter.

If true, suppresses display of compiler banner information. This parameter corresponds to the /nologo switch of the vbc.exe compiler.

NoStandardLib

Optional Boolean parameter.

Causes the compiler not to reference the standard libraries. This parameter corresponds to the /nostdlib switch of the vbc.exe compiler.

NoVBRuntimeReference

Optional Boolean parameter.

Internal use only. If true, prevents the automatic reference to Microsoft.VisualBasic.dll..

NoWarnings

Optional Boolean parameter.

If true, the task supresses all warnings. For more information, see /nowarn.

Optimize

Optional Boolean parameter.

If true, enables compiler optimizations. This parameter corresponds to the /optimize switch of the vbc.exe compiler.

OptionCompare

Optional String parameter.

Specifies how string comparisons are made. This parameter can have the following values:

  • binary

  • text

The value binary specifies that the task uses binary string comparisons. The value text specifies that the task uses text string comparisons. The default value of this parameter is binary. This parameter corresponds to the /optioncompare switch of the vbc.exe compiler.

OptionExplicit

Optional Boolean parameter.

If true, explicit declaration of variables is required. This parameter corresponds to the /optionexplicit switch of the vbc.exe compiler.

OptionInfer

Optional Boolean parameter.

If true, allows type inference of variables.

OptionStrict

Optional Boolean parameter.

If true, the task enforces strict type semantics to restrict implicit type conversions. This parameter corresponds to the /optionstrict switch of the vbc.exe compiler.

OptionStrictType

Optional String parameter.

Specifies which strict type semantics generate a warning. Currently, only "custom" is supported. This parameter corresponds to the /optionstrict switch of the vbc.exe compiler.

OutputAssembly

Optional String output parameter.

Specifies the name of the ouput file. This parameter corresponds to the /out switch of the vbc.exe compiler.

Platform

Optional String parameter.

Specifies the processor platform to be targeted by the output file. This parameter can have a value of x86, x64, Itanium, or anycpu. Default is anycpu. This parameter corresponds to the /platform switch of the vbc.exe compiler.

References

Optional ITaskItem[] parameter.

Causes the task to import public type information from the specified items into the current project. This parameter corresponds to the /reference switch of the vbc.exe compiler.

RemoveIntegerChecks

Optional Boolean parameter.

If true, disables integer overflow error checks. The default value is false. This parameter corresponds to the /removeintchecks switch of the vbc.exe compiler.

Resources

Optional ITaskItem[] parameter.

Embeds a .NET Framework resource into the output file. This parameter corresponds to the /resource switch of the vbc.exe compiler.

ResponseFiles

Optional ITaskItem[] parameter.

Specifies the response file that contains commands for this task. This parameter corresponds to the @ (Specify Response File) option of the vbc.exe compiler.

RootNamespace

Optional String parameter.

Specifies the root namespace for all type declarations. This parameter corresponds to the /rootnamespace switch of the vbc.exe compiler.

SdkPath

Optional String parameter.

Specifies the location of mscorlib.dll and microsoft.visualbasic.dll. This parameter corresponds to the /sdkpath switch of the vbc.exe compiler.

Sources

Optional ITaskItem[] parameter.

Specifies one or more Visual Basic source files.

TargetCompactFramework

Optional Boolean parameter.

If true, the task targets the .NET Compact Framework. This switch corresponds to the /netcf switch of the vbc.exe compiler.

TargetType

Optional String parameter.

Specifies the file format of the output file. This parameter can have a value of library, which creates a code library, exe, which creates a console application, module, which creates a module, or winexe, which creates a Windows program. Default is library. This parameter corresponds to the /target switch of the vbc.exe compiler.

Timeout

Optional Int32 parameter.

Specifies the amount of time, in milliseconds, after which the task executable is terminated. The default value is Int.MaxValue, indicating that there is no time out period.

ToolPath

Optional String parameter.

Specifies the location from where the task will load the underlying executable file (vbc.exe). If this parameter is not specified, the task uses the SDK installation path corresponding to the version of the framework that is running MSBuild.

TreatWarningsAsErrors

Optional Boolean parameter.

If true, all warnings are treated as errors. For more information, see /warnaserror (Visual Basic).

UseHostCompilerIfAvailable

Optional Boolean parameter.

Instructs the task to use the in-process compiler object, if available. Used only by Visual Studio.

Utf8Output

Optional Boolean parameter.

Logs compiler output using UTF-8 encoding. This parameter corresponds to the /utf8output switch of the vbc.exe compiler.

Verbosity

Optional String parameter.

Specifies the verbosity of the compiler’s output. Verbosity can be Quiet, Normal (the default), or Verbose.

WarningsAsErrors

Optional String parameter.

Specifies a list of warnings to treat as errors. For more information, see /warnaserror (Visual Basic).

This parameter overrides the TreatWarningsAsErrors parameter.

WarningsNotAsErrors

Optional String parameter.

Specifies a list of warnings that are not treated as errors. For more information, see /warnaserror (Visual Basic).

This parameter is only useful if the TreatWarningsAsErrors parameter is set to true.

Win32Icon

Optional String parameter.

Inserts an .ico file in the assembly, which gives the output file the desired appearance in File Explorer. This parameter corresponds to the /win32icon switch of the vbc.exe compiler.

Win32Resources

Optional String parameter.

Inserts a Win32 resource (.res) file in the output file. This parameter corresponds to the /win32resource switch of the vbc.exe compiler.

Remarks

In addition to the parameters listed above, this task inherits parameters from the ToolTaskExtension class, which itself inherits from the ToolTask class. For a list of these additional parameters and their descriptions, see ToolTaskExtension Base Class.

Example

The following example compiles a Visual Basic project.

<VBC
   Sources="@(sources)"
   Resources="strings.resources"
   Optimize="true"
   OutputAssembly="out.exe"/>