다음을 통해 공유


MIDL Task

Wraps the Microsoft Interface Definition Language (MIDL) compiler tool, midl.exe. For more information, see "MIDL Command-Line Reference" on the MSDN Web site.

Parameters

The following table describes the parameters of the MIDL task. Most task parameters, and a few sets of parameters, correspond to a command-line option.

Parameter

Description

AdditionalIncludeDirectories

Optional String[] parameter.

Adds a directory to the list of directories that are searched for imported IDL files, included header files, and application configuration files (ACF).

For more information, see the /I option in "MIDL Command-Line Reference" on the MSDN Web site.

AdditionalOptions

Optional String parameter.

A list of command-line options. For example, "/option1 /option2 /option#". Use this parameter to specify command-line options that are not represented by any other MIDL task parameter.

For more information, see "MIDL Command-Line Reference" on the MSDN Web site.

ApplicationConfigurationMode

Optional Boolean parameter.

If true, lets you use some ACF keywords in the IDL file.

For more information, see the /app_config option in "MIDL Command-Line Reference" on the MSDN Web site.

ClientStubFile

Optional String parameter.

Specifies the name of the client stub file for an RPC interface.

For more information, see the /cstub option in "MIDL Command-Line Reference" on the MSDN Web site. Also see the ServerStubFile parameter in this table.

CPreprocessOptions

Optional String parameter.

Specifies options to pass to the C/C++ preprocessor. Specify a space-delimited list of preprocessor options.

For more information, see the /cpp_opt option in "MIDL Command-Line Reference" on the MSDN Web site.

DefaultCharType

Optional String parameter.

Specifies the default character type that the C compiler will use to compile the generated code.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

Signed

/char signed

Unsigned

/char unsigned

Ascii

/char ascii7

For more information, see the /char option in "MIDL Command-Line Reference" on the MSDN Web site.

DllDataFileName

Optional String parameter.

Specifies the file name for the generated dlldata file for a proxy DLL.

For more information, see the /dlldata option in "MIDL Command-Line Reference" on the MSDN Web site.

EnableErrorChecks

Optional String parameter.

Specifies the type of error checking that the generated stubs will perform at run time.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

None

/error none

EnableCustom

/error

All

/error all

For more information, see the /error option in "MIDL Command-Line Reference" on the MSDN Web site.

ErrorCheckAllocations

Optional Boolean parameter.

If true, check for out-of-memory errors.

For more information, see the /error allocation option in "MIDL Command-Line Reference" on the MSDN Web site.

ErrorCheckBounds

Optional Boolean parameter.

If true, checks the size of conformant-varying and varying arrays against the transmission length specification.

For more information, see the /error bounds_check option in "MIDL Command-Line Reference" on the MSDN Web site.

ErrorCheckEnumRange

Optional Boolean parameter.

If true, checks that enum values are in an allowable range.

For more information, see the /error enum option in command-line help (/?) for midl.exe.

ErrorCheckRefPointers

Optional Boolean parameter.

If true, check that no null reference pointers are passed to client stubs.

For more information, see the /error ref option in "MIDL Command-Line Reference" on the MSDN Web site.

ErrorCheckStubData

Optional Boolean parameter.

If true, generates a stub that catches unmarshaling exceptions on the server side and propagates them back to the client.

For more information, see the /error stub_data option in "MIDL Command-Line Reference" on the MSDN Web site.

GenerateClientFiles

Optional String parameter.

Specifies whether the compiler generates client-side C source files for an RPC interface.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

None

/client none

Stub

/client stub

For more information, see the /client option in "MIDL Command-Line Reference" on the MSDN Web site.

GenerateServerFiles

Optional String parameter.

Specifies whether the compiler generates server-side C source files for an RPC interface.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

None

/server none

Stub

/server stub

For more information, see the /server option in "MIDL Command-Line Reference" on the MSDN Web site.

GenerateStublessProxies

Optional Boolean parameter.

If true, generates fully interpreted stubs together with stubless proxies for object interfaces.

For more information, see the /Oicf option in "MIDL Command-Line Reference" on the MSDN Web site.

GenerateTypeLibrary

Optional Boolean parameter.

If true, a type library (.tlb) file is not generated.

For more information, see the /notlb option in "MIDL Command-Line Reference" on the MSDN Web site.

HeaderFileName

Optional String parameter.

Specifies the name of the generated header file.

For more information, see the /h or /header option in "MIDL Command-Line Reference" on the MSDN Web site.

IgnoreStandardIncludePath

Optional Boolean parameter.

If true, the MIDL task searches only the directories specified by using the AdditionalIncludeDirectories switch, and ignores the current directory and the directories specified by the INCLUDE environment variable.

For more information, see the /no_def_idir option in "MIDL Command-Line Reference" on the MSDN Web site.

InterfaceIdentifierFileName

Optional String parameter.

Specifies the name of the interface identifier file for a COM interface. This overrides the default name obtained by adding "_i.c" to the IDL file name.

For more information, see the /iid option in "MIDL Command-Line Reference" on the MSDN Web site.

LocaleID

Optional int parameter.

Specifies the locale identifier that enables the use of international characters in input files, file names, and directory paths. Specify a decimal locale identifier.

For more information, see the /lcid option in "MIDL Command-Line Reference" on the MSDN Web site. Also see "Locale IDs Assigned by Microsoft" at MSDN.

MkTypLibCompatible

Optional Boolean parameter.

If true, requires the format of the input file to be compatible with mktyplib.exe version 2.03.

For more information, see the /mktyplib203 option in "MIDL Command-Line Reference" on the MSDN Web site. Also, see "ODL File Syntax" on the MSDN Web site.

OutputDirectory

Optional String parameter.

Specifies the default directory where the MIDL task writes output files.

For more information, see the /out option in "MIDL Command-Line Reference" on the MSDN Web site.

PreprocessorDefinitions

Optional String[] parameter.

Specifies one or more defines; that is, a name and an optional value to be passed to the C preprocessor as if by a #define directive. The form of each define is, name[=value].

For more information, see the /D option in "MIDL Command-Line Reference" on the MSDN Web site. Also, see the UndefinePreprocessorDefinitions parameter in this table.

ProxyFileName

Optional String parameter.

Specifies the name of the interface proxy file for a COM interface.

For more information, see the /proxy option in "MIDL Command-Line Reference" on the MSDN Web site.

RedirectOutputAndErrors

Optional String parameter.

Redirects output, such as error messages and warnings, from standard output to the specified file.

For more information, see the /o option in "MIDL Command-Line Reference" on the MSDN Web site.

ServerStubFile

Optional String parameter.

Specifies the name of the server stub file for an RPC interface.

For more information, see the /sstub option in "MIDL Command-Line Reference" on the MSDN Web site. Also, see the ClientStubFile parameter in this table.

Source

Required ITaskItem[] parameter.

Specifies a list of source files separated by spaces.

StructMemberAlignment

Optional String parameter.

Specifies the alignment (packing level) of structures in the target system.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

NotSet

<none>

1

/Zp1

2

/Zp2

4

/Zp4

8

/Zp8

For more information, see the /Zp option in "MIDL Command-Line Reference" on the MSDN Web site. The /Zp option is equivalent to the /pack option and the older /align option.

SuppressCompilerWarnings

Optional Boolean parameter.

If true, suppresses warning messages from the MIDL task.

For more information, see the /no_warn option in "MIDL Command-Line Reference" on the MSDN Web site.

SuppressStartupBanner

Optional Boolean parameter.

If true, prevents the display of the copyright and version number message when the task starts.

For more information, see the /nologo option in "MIDL Command-Line Reference" on the MSDN Web site.

TargetEnvironment

Optional String parameter.

Specifies the environment in which the application runs.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

NotSet

<none>

Win32

/env win32

Itanium

/env ia64

X64

/env x64

For more information, see the /env option in "MIDL Command-Line Reference" on the MSDN Web site.

TrackerLogDirectory

Optional String parameter.

Specifies the intermediate directory where tracking logs for this task are stored.

TypeLibFormat

Optional String parameter.

Specifies the format of the type library file.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

NewFormat

/newtlb

OldFormat

/oldtlb

For more information, see the /newtlb and /oldtlb options in "MIDL Command-Line Reference" on the MSDN Web site.

TypeLibraryName

Optional String parameter.

Specifies the name of the type library file.

For more information, see the /tlb option in "MIDL Command-Line Reference" on the MSDN Web site.

UndefinePreprocessorDefinitions

Optional String[] parameter.

Removes any previous definition of a name by passing the name to the C preprocessor as if by a #undefine directive. Specify one or more previously defined names.

For more information, see the /U option in "MIDL Command-Line Reference" on the MSDN Web site. Also, see the PreprocessorDefinitions parameter in this table.

ValidateAllParameters

Optional Boolean parameter.

If true, generates additional error-checking information that is used to perform integrity checks at run time. If false, the error-checking information is not generated.

For more information, see the /robust and /no_robust options in "MIDL Command-Line Reference" on the MSDN Web site.

WarnAsError

Optional Boolean parameter.

If true, treats all warnings as errors.

If the WarningLevel MIDL task parameter is not specified, warnings at the default level, level 1, are treated as errors.

For more information, see the /WX options in "MIDL Command-Line Reference" on the MSDN Web site. Also, see the WarningLevel parameter in this table.

WarningLevel

Optional String parameter.

Specifies the severity (warning level) of warnings to emit. No warning is emitted for a value of 0. Otherwise, a warning is emitted if its warning level is numerically less than or equal to the specified value.

Specify one of the following values, each of which corresponds to a command-line option.

Value

Command-line option

0

/W0

1

/W1

2

/W2

3

/W3

4

/W4

For more information, see the /W option in "MIDL Command-Line Reference" on the MSDN Web site. Also, see the WarnAsError parameter in this table.

See Also

Other Resources

MSBuild Task Reference