ComCompatibleVersionAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<AttributeUsageAttribute(AttributeTargets.Assembly, Inherited:=False)> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class ComCompatibleVersionAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Assembly, Inherited=false)] [ComVisibleAttribute(true)] public sealed class ComCompatibleVersionAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Assembly, Inherited=false)] [ComVisibleAttribute(true)] public ref class ComCompatibleVersionAttribute sealed : public Attribute

既定で タイプ ライブラリ エクスポータ (Tlbexp.exe) は、アセンブリのバージョン番号を使用してクラス ID (CLSID) を算出します。パブリックで COM 参照可能な各クラスには、新しいアセンブリのバージョンをエクスポートするごとに新しい CLSID が与えられます。
ComCompatibleVersionAttribute 属性を適用すると、現在のバージョンのアセンブリ内のクラスの CLSID がすべて、以前のバージョンのアセンブリ内のクラスの CLSID と同じになります。CLSID が同じである限り、以前のアセンブリをアンインストールした後でも、COM のレガシ アプリケーションは互換性があるアセンブリの最新バージョンをそのまま使用できます。CLSID を明示的に設定するため System.Runtime.InteropServices.GuidAttribute をクラスに適用した場合、ComCompatibleVersionAttribute は無視されます。
アセンブリのバージョンの 4 つの部分は、この属性のプロパティの組み合わせで表されます。必ず、現在のアセンブリと下位互換性がある一番低いバージョンを指定してください。このバージョン情報がアセンブリ内のすべての CLSID の計算に使用されます。

アセンブリのバージョンとして 1.0.0.0 を指定する方法を次の例に示します。この例では、アセンブリのバージョンにこれより大きい番号が定義されています。アセンブリの新しいバージョン番号にかかわらず、アセンブリ内の CLSID はすべてバージョン 1.0.0.0 を使用して生成されます。アセンブリの現在のバージョンは無視されます。

System.Attribute
System.Runtime.InteropServices.ComCompatibleVersionAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ComCompatibleVersionAttribute クラスのページへのリンク