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

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

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

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

マネージド ソース コードでプライマリ相互運用機能アセンブリを指定するには、デザイン時に System.Runtime.InteropServices.GuidAttributePrimaryInteropAssemblyAttribute をアセンブリに適用する必要があります。 プライマリ相互運用機能アセンブリの GuidAttribute はタイプ ライブラリのリビドを識別し、 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)

適用対象

こちらもご覧ください