Freigeben über


IMetaDataAssemblyEmit::DefineAssemblyRef Method

Creates an AssemblyRef structure containing metadata for the assembly that this assembly references, and returns the associated metadata token.

HRESULT DefineAssemblyRef (
    [in]  void                *pbPublicKeyOrToken,
    [in]  ULONG               cbPublicKeyOrToken,
    [in]  LPCWSTR             szName,
    [in]  ASSEMBLYMETADATA    pMetaData,
    [in]  void                *pbHashValue,
    [in]  ULONG               cbHashValue,
    [in]  DWORD               dwAssemblyRefFlags,
    [out] mdAssemblyRef       *pmdar
);

Parameters

  • pbPublicKeyOrToken
    [in] The public key of the publisher of the referenced assembly. The helper function StrongNameTokenFromAssembly Function can be used to get the hash of the public key to pass as this parameter.
  • cbPublicKeyOrToken
    [in] The size in bytes of pbPublicKeyOrToken.
  • szName
    [in] The human-readable text name of the assembly. This value must not exceed 1024 characters.
  • pMetaData
    [in] An ASSEMBLYMETADATA Structure instance that contains the version, platform and locale information of the referenced assembly.
  • pbHashValue
    [in] The hash data associated with the referenced assembly. Optional.
  • cbHashValue
    [in] The size in bytes of pbHashValue.
  • pmdar
    [out] A pointer to the returned AssemblyRef metadata token.

Remarks

One AssemblyRef metadata structure must be defined for each assembly that this assembly references.

At run time, the details of a referenced assembly are passed to the assembly resolver with an indication that they represent the "as built" information. The assembly resolver then applies policy.

Requirements

Platform: Windows 2000, Windows XP, Windows Server 2003 family

Header: Cor.h

Library: Used as a resource in MsCorEE.dll

.NET Framework Version: 2.0, 1.1, 1.0

See Also

Reference

IMetaDataAssemblyEmit Interface