Marshal.GetTypeLibGuidForAssembly(Assembly) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves the library identifier (LIBID) that is assigned to a type library when it was exported from the specified assembly.
public:
static Guid GetTypeLibGuidForAssembly(System::Reflection::Assembly ^ asm);
public static Guid GetTypeLibGuidForAssembly (System.Reflection.Assembly asm);
[System.Security.SecurityCritical]
public static Guid GetTypeLibGuidForAssembly (System.Reflection.Assembly asm);
static member GetTypeLibGuidForAssembly : System.Reflection.Assembly -> Guid
[<System.Security.SecurityCritical>]
static member GetTypeLibGuidForAssembly : System.Reflection.Assembly -> Guid
Public Shared Function GetTypeLibGuidForAssembly (asm As Assembly) As Guid
Parameters
- asm
- Assembly
The assembly from which the type library was exported.
Returns
The LIBID that is assigned to a type library when it is exported from the specified assembly.
- Attributes
Exceptions
asm
is null
.
Remarks
When assemblies are exported to type libraries, the type library is assigned a LIBID. You can set the LIBID explicitly by applying the System.Runtime.InteropServices.GuidAttribute at the assembly level, or it can be generated automatically. The Tlbimp.exe (Type Library Importer) tool calculates a LIBID value based on the identity of the assembly. GetTypeLibGuid returns the LIBID that is associated with the GuidAttribute, if the attribute is applied. Otherwise, GetTypeLibGuidForAssembly returns the calculated value. Alternatively, you can use the GetTypeLibGuid method to extract the actual LIBID from an existing type library.
See the Exported Assembly Conversion topic for more information about library identifiers.