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

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

厳密な名前を付けたアセンブリを構築する場合は、この属性または AssemblyKeyNameAttribute のいずれかを指定する必要があります。AssemblyDelaySignAttribute も指定した場合は、通常このファイルは公開キーだけを格納します。
たとえば、構文は [assembly:AssemblyKeyFileAttribute("myKey.snk")] のようになります。
![]() |
---|
パスとファイル名は永続化されるため、AssemblyKeyFileAttribute で使用する文字列に、機密情報を使用しないでください。 |

AssemblyDelaySignAttribute 属性と AssemblyKeyFileAttribute を使用するコード例を次に示します。この例をコンパイルするには、厳密名ツール (Sn.exe) を使用して、TestPublicKey.snk という名前で厳密な名前のキー ファイルを作成する必要があります。
sn -k TestPublicKey.snk
この例を .dll としてコンパイルします。コマンド ラインからコンパイルする場合は、/t:library オプション (C# または Visual Basic の場合) または /LD リンカ オプション (Visual C++ の場合) を使用します。
Imports System Imports System.Reflection <assembly:AssemblyDelaySignAttribute(true)> <assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")> Namespace DelaySign Public class Test End Class End Namespace

System.Attribute
System.Reflection.AssemblyKeyFileAttribute


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


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