Vbc Task

Description

This task compiles Visual Basic.NET source into executables or modules. The task requires vbc.exe on the execute path, unless it or an equivalent program is specified in the executable parameter

All parameters are optional: <vbc/> should suffice to produce a debug build of all *.vb files.

The task is a directory based task, so attributes like includes="**\/*.vb" and excludes="broken.vb" can be used to control the files pulled in. By default, all *.vb files from the project folder down are included in the command. When this happens the destFile -if not specified- is taken as the first file in the list, which may be somewhat hard to control. Specifying the output file with destfile is prudent.

Also, dependency checking only works if destfile is set. As with <csc> nested src filesets of source, reference filesets, definitions and resources can be provided.

Parameters

Attribute Description Type Requirement
additionalmodules Semicolon separated list of modules to refer to. String Optional
debug set the debug flag on or off. boolean
destdir Set the destination directory of files to be compiled. File
destfile Set the name of exe/library to create. File
executable set the name of the program, overriding the defaults. Can be used to set the full path to a program, or to switch to an alternate implementation of the command, such as the Mono or Rotor versions -provided they use the same command line arguments as the .NET framework edition String
extraoptions Any extra options which are not explicitly supported by this task. String
failonerror If true, fail on compilation errors. boolean
imports Declare global imports for namespaces in referenced metadata files. String
includedefaultreferences If true, automatically includes the common assemblies in dotnet, and tells the compiler to link in mscore.dll. set the automatic reference inclusion flag on or off this flag controls the /nostdlib option in CSC boolean
mainclass Sets the name of main class for executables. String
optimize If true, enables optimization flag. boolean
optioncompare Specify binary- or text-style string comparisons. Defaults to "binary" String
optionexplicit Whether to require explicit declaration of variables. boolean
optionstrict Enforce strict language semantics. boolean
referencefiles Path of references to include. Wildcards should work. Path
references Semicolon separated list of DLLs to refer to. String
removeintchecks Whether to remove integer checks. Default false. boolean
rootnamespace Specifies the root namespace for all type declarations. String
srcdir Set the source directory of the files to be compiled. File
targettype set the target type to one of exe|library|module|winexe "exe", "library", "module", "winexe"
utf8output If true, require all compiler output to be in UTF8 format. boolean
warnlevel Level of warning currently between 1 and 4 with 4 being the strictest. int
win32icon Set the filename of icon to include. File
win32res Sets the filename of a win32 resource (.RES) file to include. This is not a .NET resource, but what Windows is used to. File
useresponsefile Sets whether a response file instead of a command line only invocation should be used. Defaults to false but Ant will still use a response file if more than 64 command line arguments would be used. boolean

Parameters as nested elements

define (org.apache.ant.dotnet.compile..DotnetDefine)

add a define to the list of definitions

reference (org.apache.tools.ant.types.FileSet)

add a new reference fileset to the compilation

resource (org.apache.ant.dotnet.compile.DotnetResource)

link or embed a resource

src (org.apache.tools.ant.types.FileSet)

add a new source directory to the compile

Examples

<vbc optimize="true" debug="false"
  warnLevel="4" targetType="exe" definitions="RELEASE"
  excludes="src/unicode_class.vb" mainClass="MainApp"
  destFile="NetApp.exe" optionExplicit="true"
  optionCompare="text" references="System.Xml,System.Web.Xml" >
    <reference file="${testCSC.dll}"/>
    <define name="RELEASE"/>
    <define name="DEBUG" if="debug.property"/>
    <define name="def3" unless="def2.property"/>
</vbc>