PrimaryInteropAssemblyAttribute クラス

定義

この属性が適用されたアセンブリが、プライマリ相互運用機能アセンブリであることを示します。

public ref class PrimaryInteropAssemblyAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
public sealed class PrimaryInteropAssemblyAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)]
public sealed class PrimaryInteropAssemblyAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class PrimaryInteropAssemblyAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)>]
type PrimaryInteropAssemblyAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)>]
type PrimaryInteropAssemblyAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PrimaryInteropAssemblyAttribute = class
    inherit Attribute
Public NotInheritable Class PrimaryInteropAssemblyAttribute
Inherits Attribute
継承
PrimaryInteropAssemblyAttribute
属性

注釈

この属性はアセンブリに適用できますが、通常はタイプ ライブラリをインポートするときに 、Tlbimp.exe (タイプ ライブラリ インポーター) によって適用されます。

相互運用機能アセンブリには、COM タイプ ライブラリで既に説明されている既存の COM 型を記述するメタデータが含まれています。 Tlbimp.exe は、COM タイプ ライブラリから相互運用機能アセンブリを生成します。 相互運用機能アセンブリには通常、メタデータのみが含まれます (コードは含められていません)。 プライマリ相互運用機能アセンブリは、記述するタイプ ライブラリと同じ発行元によって提供され、そのタイプ ライブラリで定義されている型の公式な定義を提供します。 プライマリ相互運用機能アセンブリは、一意性を確保するために、常にパブリッシャーによって署名されます。

タイプ ライブラリからプライマリ相互運用機能アセンブリを生成する方法は次のとおりです。

  • コマンド ラインから オプションを指定して TlbImp.exe /primary を実行します。

  • デザイン時に を適用します PrimaryInteropAssemblyAttribute

マネージド ソース コードでプライマリ相互運用機能アセンブリを指定するには、デザイン時に アセンブリに と PrimaryInteropAssemblyAttribute を適用System.Runtime.InteropServices.GuidAttributeする必要があります。 プライマリ相互運用機能アセンブリの は GuidAttribute タイプ ライブラリの LIBID を識別し、 PrimaryInteropAssemblyAttribute は、このアセンブリがプライマリ相互運用機能アセンブリである特定のタイプ ライブラリのバージョンを識別します。 アセンブリが同じタイプ ライブラリの複数のバージョンのプライマリ相互運用機能アセンブリである場合、 は PrimaryInteropAssemblyAttribute 複数回表示されます。

タイプ ライブラリで定義されている型を使用する場合は、型自体を再インポートまたは再定義するのではなく、そのタイプ ライブラリのプライマリ相互運用機能アセンブリを常に参照します。 プライマリ相互運用機能アセンブリを生成または使用する方法のガイドラインと手順については、「 プライマリ相互運用機能アセンブリ」を参照してください。 タイプ ライブラリのインポート プロセスの詳細については、「 タイプ ライブラリからアセンブリへの変換の概要」を参照してください。

コンストラクター

PrimaryInteropAssemblyAttribute(Int32, Int32)

このアセンブリがプライマリ相互運用機能アセンブリとなるタイプ ライブラリのメジャー バージョン番号とマイナー バージョン番号を指定して、PrimaryInteropAssemblyAttribute クラスのインスタンスを初期化します。

プロパティ

MajorVersion

対象のアセンブリがプライマリ相互運用機能アセンブリであるタイプ ライブラリのメジャー バージョン番号を取得します。

MinorVersion

対象のアセンブリがプライマリ相互運用機能アセンブリであるタイプ ライブラリのマイナー バージョン番号を取得します。

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)

メソッド

Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

こちらもご覧ください