# <midl>

This tasks allows you to run MIDL.exe.

This task only supports a small subset of the MIDL.EXE command line switches, but you can use the options element to specify any other unsupported commands you want to specify.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
filename | file | Name of .IDL file to process. | True
acf | string | The /acf switch allows the user to supply an explicit ACF file name. The switch also allows the use of different interface names in the IDL and ACF files. | False
align | string | The /align switch is functionally the same as the MIDL /Zp option and is recognized by the MIDL compiler solely for backward compatibility with MkTypLib. | False
app_config | bool | The /app_config switch selects application-configuration mode, which allows you to use some ACF keywords in the IDL file. With this MIDL compiler switch, you can omit the ACF and specify an interface in a single IDL file. | False
char | string | The /char switch helps to ensure that the MIDL compiler and C compiler operate together correctly for all char and small types. | False
client | string | The /client switch directs the MIDL compiler to generate client-side C source files for an RPC interface | False
cstub | string | The /cstub switch specifies the name of the client stub file for an RPC interface. | False
dlldata | file | Specifies the file name for the generated dlldata file for a proxy DLL. The default file name Dlldata.c is used if `dlldata` is not specified. | False
env | string | The /env switch selects the environment in which the application runs. | False
header | file | Specifies the name of the header file. | False
iid | file | Specifies the name of the interface identifier file for a COM interface, overriding the default name obtained by adding _i.c to the IDL file name. | False
Oi | string | The /Oi switch directs the MIDL compiler to use a fully-interpreted marshaling method. The /Oic and /Oicf switches provide additional performance enhancements. | False
proxy | file | Specifies the name of the interface proxy file for a COM interface. | False
tlb | file | Specifies a file name for the type library generated by the MIDL compiler. | False
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False
timeout | int | The maximum amount of time the application is allowed to execute, expressed in milliseconds. Defaults to no time-out. | False
unless | bool | Opposite of `if`. If false then the task will be executed; otherwise, skipped. The default is false. | False
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False

### Framework-configurable parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
exename | string | The name of the executable that should be used to launch the external program. | False
useruntimeengine | bool | Specifies whether the external program should be executed using a runtime engine, if configured. The default is false. | False

### Nested Elements:

#### <options>

Additional options to pass to midl.exe.

##### <option>

Represents an option.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
name | string | Name of the option. | True
if | bool | Indicates if the option should be passed to the task. If true then the option will be passed; otherwise, skipped. The default is true. | False
unless | bool | Indicates if the option should not be passed to the task. If false then the option will be passed; otherwise, skipped. The default is false. | False
value | string | Value of the option. The default is a null reference (Nothing in Visual Basic). | False

##### </option>

#### </options>

#### <defines>

Macro definitions to pass to mdil.exe. Each entry will generate a /D

##### <define>

Represents an option.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
name | string | Name of the option. | True
if | bool | Indicates if the option should be passed to the task. If true then the option will be passed; otherwise, skipped. The default is true. | False
unless | bool | Indicates if the option should not be passed to the task. If false then the option will be passed; otherwise, skipped. The default is false. | False
value | string | Value of the option. The default is a null reference (Nothing in Visual Basic). | False

##### </define>

#### </defines>

#### <undefines>

Macro undefines (/U) to pass to mdil.

##### <undefine>

Represents an option.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
name | string | Name of the option. | True
if | bool | Indicates if the option should be passed to the task. If true then the option will be passed; otherwise, skipped. The default is true. | False
unless | bool | Indicates if the option should not be passed to the task. If false then the option will be passed; otherwise, skipped. The default is false. | False
value | string | Value of the option. The default is a null reference (Nothing in Visual Basic). | False

##### </undefine>

#### </undefines>

#### <includedirs>

The list of directories in which to search for include files.

#### </includedirs>

#### <arg>

The command-line arguments for the external program.

Represents a command-line argument.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
dir | directory | The value for a directory-based command-line argument; will be replaced with the absolute path of the directory. | False
file | file | The name of a file as a single command-line argument; will be replaced with the absolute filename of the file. | False
if | bool | Indicates if the argument should be passed to the external program. If true then the argument will be passed; otherwise, skipped. The default is true. | False
line | string | List of command-line arguments; will be passed to the executable as is. | False
path | <path> | The value for a PATH-like command-line argument; you can use `:` or `;` as path separators and NAnt will convert it to the platform's local conventions, while resolving references to environment variables. | False
unless | bool | Indicates if the argument should not be passed to the external program. If false then the argument will be passed; otherwise, skipped. The default is false. | False
value | string | A single command-line argument; can contain space characters. | False

### Nested Elements:

#### <path>

Sets a single command-line argument and treats it like a PATH - ensures the right separator for the local platform is used.

#### </path>

### Examples

- A single command-line argument containing a space character.

      <arg value="-l -a" />

- Two separate command-line arguments.

      <arg line="-l -a" />

- A single command-line argument with the value `\dir;\dir2;\dir3` on DOS-based systems and `/dir:/dir2:/dir3` on Unix-like systems.

      <arg path="/dir;/dir2:\dir3" />

#### </arg>

### Examples

-     <midl
          env="win32"
          Oi="cf"
          tlb="${outputdir}\TempAtl.tlb"
          header="${outputdir}\TempAtl.h"
          iid="${outputdir}\TempAtl_i.c"
          proxy="${outputdir}\TempAtl_p.c"
          filename="TempAtl.idl"
      >
          <defines>
              <define name="_DEBUG"/>
              <define name="WIN32" value="1"/>
          </defines>
          <options>
              <option name="/mktyplib203"/>
              <option name="/error" value="allocation"/>
          </options>
      </midl>

### Requirements

Assembly: NAnt.VisualCppTasks (0.85.2478.0)