<Doctype HTML public-wcdtd XHTML stricten httpwwwworgtrxhtmldtdxhtml-strictdtd>
The Type Library import program converts the type definition in the com Type Library to the equivalent definition in the Assembly during the common language runtime. Tlbimp.exe outputs binary (assembly), which contains runtime metadata of the type defined in the original type library. You can use tools such as ildasm.exe to check this file.
The Type Library import program is automatically installed with Visual Studio. To start the tool, use the Visual Studio command prompt. In the command prompt, type the following command:
Tlbimp tlbfile [Options]Parameters
Tlbfile
The name of any file that contains the com-Type Library.
/Asmversion:Versionnumber
Specifies the version number of the assembly to be generated. ToMajor. Minor. Build. RevisionFormat specifiedVersionnumber.
/Delaysign
Specify to tlbimp.exe to use a delayed signature to sign the result assembly with a strong name. This option must be/Keycontainer:,/Keyfile:Or/Publickey:Options. For more information about the delayed signature process, see delay for assembly signature.
/Help
Displays the command syntax and options of the tool.
/Keycontainer:Container name
Used inContainernameThe public/private key pair found in the specified key container to issue a result assembly with a strong name.
/Keyfile:Filename
Used inFilenameTo issue a result assembly with a strong name.
/Namespace:Namespace -- namespace
Specify the namespace in which the Assembly is generated.
/Noclassmembers
Prevents tlbimp.exe from adding members to the class. This avoids the potential typeloadexception.
/Nologo
Undisplay Microsoft startup title.
/Out:Filename
Specify the name of the output file, assembly, and namespace to be written into the metadata definition. If the Interface Definition Language (IDL) custom feature specified by the Type Library explicitly controls the namespace of the Assembly/OutOption does not affect the namespace of the Assembly. If this option is not specified, tlbimp.exe writes the metadata to a file with the same name as the actual Type Library defined in the input file and assigns it A. dll extension. If the name of the output file is the same as that of the input file, the tool will generate an error to avoid overwriting this type of library.
/Primary
Generate the master InterOP assembly of the specified type library. Related information will be added to the Assembly to indicate that the publisher of the Type Library has generated the assembly. By specifying the primary interoperability assembly, you can use tlbimp.exe to distinguish the publisher assembly from any other Assembly created from the Type Library. If you are the publisher of the Type Library imported with tlbimp.exe, you can only use/Primary. Note that a strong name must be assigned to the main interoperability assembly. For more information, see primary interoperability assembly.
/Publickey:Filename
Specifies the file that contains the public key used to issue the result assembly. If you specify/Keyfile:Or/Keycontainer:Option rather/Publickey:, Tlbimp.exe will/Keyfile:Or/Keycontainer:The public key/private key pair provided to generate the public key.Publickey:Option supports the test key and latency signature scheme. The file format is the format generated by sn.exe. For more information, see-P.
/Reference:Filename
Specifies the Assembly file to parse references to types defined outside the current type library. If you do not specify/ReferenceOtherwise, tlbimp.exe will automatically import the external Type Library referenced by any imported type library recursively. If you specify/ReferenceBefore importing other types of libraries, the tool will try to parse the external types in the referenced assembly.
/Silent
The message indicating successful cancellation is displayed.
/Strictref
If this tool cannot parse the current Assembly,/ReferenceDo not import the Type Library.
/Strictref: nopia
And/StrictrefSame, but ignore Pia.
/Sysarray
Specify the tool to import the com style safearray as the managed system. array class type.
/Tlbreference:Filename
Specifies the type library file for parsing the Type Library Reference without referring to the Registry.
Note that this option does not load some earlier Type Library formats. However, you can use the registry or the current directory to implicitly load the earlier type library format.
/Transform:Transformname
PressTransformnameThe specified conversion metadata of the parameter.
SpecifyDispretAsTransformnameYou can convert the [out, retval] parameters of methods that only support scheduling interfaces (scheduling interfaces) to return values.
For more information about this option, see the example below this topic.
/Unsafe
Generate an interface without performing. NET Framework security checks. Calling methods exposed in this way may cause security risks. This option should not be used if you are not aware of the risk of making such code public.
/Verbose
Specify the verbose mode. Additional information about the Imported Type Library is displayed.
/?
Displays the command syntax and options of the tool.
The command line options of tlbimp.exe are case-insensitive and can be provided in any order. You only need to specify enough options to uniquely identify it. Therefore,/NAnd/NologoEquivalent,/Ou:OUTFILE. dllAnd/Out:OUTFILE. dllEquivalent.
Remarks
Tlbimp.exe converts the entire Type Library at the same time. This tool cannot be used to generate type information for a type subset defined in a single type library.
It is usually useful or necessary to assign a strong name to an assembly. Due to this, tlbimp.exe includes the corresponding options to provide required information to generate an assembly with a strong name./Keyfile:And/Keycontainer:All options are issued with a strong name assembly. Therefore, it is reasonable to provide only one of these options at a time.
When importing a Type Library from a module that contains multiple types of libraries, You can append the resource ID to a Type Library file. Tlbimp.exe can find the file only when the current library file is stored in the current directory. See the examples later in this topic.
Example
The Assembly generated by the following command has the same name and. dll extension as the Type Library found in mytest. TLB.
Tlbimp mytest. TLB
The following command generates an Assembly named mytest. dll.
Tlbimp mytest. TLB/out: mytest. dll
The Assembly generated by the following command has the same name as the Type Library specified by mymodule. dll \ 1 and has the. dll extension. Mymodule. dll \ 1 must be in the current directory.
Tlbimp mymodule. dll \ 1
The following command generates an Assembly named mytestlib. DLL for the Type Library testlib. dll./Transform: dispretOption to convert any [out, retval] parameter of the scheduling interface method in this type of Library to the return value in the library.
Tlbimp testlib. dll/transform: dispret/out: mytestlib. dll
In the above example, the Type Library testlib. dll contains a scheduling interface method named somemethod, which returns void and has a [out, retval] parameter. The following code is the somemethod input type library method signature in testlib. dll.
Void somemethod ([out, retval] variant_bool *);
Specify/Transform: dispretOption causes tlbimp.exe to convert the [out, retval] parameter of somemethod to the return value of bool. If you specify/Transform: dispretDuring the upload, tlbimp.exe is the method signature generated by somemethod in the mytestlib. dll library.
BoolSomemethod ();
If tlbimp.exe is used to generate the keystore library of testlib. dll/Transform: dispretThe tool generates the following method signature for somemethod in mytestlib. dll.
VoidSomemethod (OutBoolX );SeeSee tlbexp.exe( ililildasm.exe (msil snsnsnsnsn.exe () Visual Studio command prompt. The concept of importing a Type Library as an assembly into an assembly with a strong name is used to import type libraries to the interoperability assembly. net Framework tool for converting from a type library to an assembly # C # column