ResolveComReference Task

Takes a list of one or more type library names or .tlb files and resolves those type libraries to locations on disk.

Parameters

The following table describes the parameters of the ResolveCOMReference task.

Parameter

Description

DelaySign

Optional Boolean parameter.

If true, places the public key in the assembly. If false, fully signs the assembly.

EnvironmentVariables

Optional String[] parameter.

Array of pairs of environment variables, separated by equal signs. These variables are passed to the spawned tlbimp.exe and aximp.exe in addition to, or selectively overriding, the regular environment block..

ExecuteAsTool

Optional Boolean parameter.

If true, runs tlbimp.exe and aximp.exe from the appropriate target framework out-of-proc to generate the necessary wrapper assemblies. This parameter enables multi-targeting.

IncludeVersionInInteropName

Optional Boolean parameter.

If true, the typelib version will be included in the wrapper name. The default is false.

KeyContainer

Optional String parameter.

Specifies a container that holds a public/private

key pair.

KeyFile

Optional String parameter.

Specifies an item that contains a public/private

key pair.

NoClassMembers

Optional Boolean parameter.

ResolvedAssemblyReferences

Optional ITaskItem[] output parameter.

Specifies the resolved assembly references.

ResolvedFiles

Optional ITaskItem[] output parameter.

Specifies the fully qualified files on disk that correspond to the physical locations of the type libraries that were provided as input to this task.

ResolvedModules

Optional ITaskItem[] parameter.

SdkToolsPath

Optional [String] parameter.

If ExecuteAsTool is true, this parameter must be set to the SDK tools path for the framework version being targeted.

StateFile

Optional [String] parameter.

Specifies the cache file for COM component timestamps. If not present, every run will regenerate all the wrappers.

TargetFrameworkVersion

Optional [String] parameter.

Specifies the project target framework version.

The default is String.Empty. which means there is no filtering for a reference based on the target framework.

TargetProcessorArchitecture

Optional [String] parameter.

Specifies the preferred target processor architecture. Passed to the tlbimp.exe /machine flag after translation.

The parameter value should be a member of ProcessorArchitecture.

TypeLibFiles

Optional ITaskItem[] parameter.

Specifies the type library file path to COM references. Items included in this parameter may contain item metadata. For more information, see the section "TypeLibFiles Item Metadata" below.

TypeLibNames

Optional ITaskItem[] parameter.

Specifies the type library names to resolve. Items included in this parameter must contain some item metadata. For more information, see the section "TypeLibNames Item Metadata" below.

WrapperOutputDirectory

Optional String parameter.

The location on disk where the generated interop assembly is placed. If this item metadata is not specified, the task uses the absolute path of the directory where the project file is located.

Remarks

TypeLibNames Item Metadata

The following table describes the item metadata available for items passed to the TypeLibNames parameter.

Metadata

Description

GUID

Required item metadata.

The GUID for the type library. If this item metadata is not specified , the task fails.

VersionMajor

Required item metadata.

The major version of the type library. If this item metadata is not specified , the task fails.

VersionMinor

Required item metadata.

The minor version of the type library. If this item metadata is not specified, the task fails.

LocaleIdentifier

Optional item metadata.

The Locale Identifier (or LCID) for the type library. This is specified as a 32-bit value that identifies the human language preferred by a user, region, or application. If this item metadata is not specified, the task uses a default locale identifier of "0".

WrapperTool

Optional item metadata.

Specifies the wrapper tool that is used to generate the assembly wrapper for this type library. If this item metadata is not specified, the task uses a default wrapper tool of "tlbimp". The available, case insensitive choices of typelibs are:

  • Primary: Use this wrapper tool when you want to use an already generated primary interop assembly for the COM component. When you use this wrapper tool, do not specify a wrapper output directory because that will cause the task to fail.

  • TLBImp: Use this wrapper tool when you want to generate an interop assembly for the COM component.

  • AXImp:Use this wrapper tool when you want to generate an interop assembly for an ActiveX Control.

TypeLibFiles Item Metadata

The following table describes the item metadata available for items passed to the TypeLibFiles parameter.

Metadata

Description

WrapperTool

Optional item metadata.

Specifies the wrapper tool that is used to generate the assembly wrapper for this type library. If this item metadata is not specified, the task uses a default wrapper tool of "tlbimp". The available, case insensitive choices of typelibs are:

  • Primary: Use this wrapper tool when you want to use an already generated primary interop assembly for the COM component. When you use this wrapper tool, do not specify a wrapper output directory because that will cause the task to fail.

  • TLBImp: Use this wrapper tool when you want to generate an interop assembly for the COM component.

  • AXImp: Use this wrapper tool when you want to generate an interop assembly for an ActiveX Control.

Note

The more information that you provide to uniquely identify a type library, the greater the possibility that the task will resolve to the correct file on disk.

Remarks

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

See Also

Concepts

MSBuild Tasks

Other Resources

MSBuild Task Reference