更新 : 2007 年 11 月
厳密な名前を生成するために使用するキー ペアを格納しているファイルの名前を指定します。
名前空間 :
System.Reflection アセンブリ :
mscorlib (mscorlib.dll 内)
<AttributeUsageAttribute(AttributeTargets.Assembly, Inherited := False)> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class AssemblyKeyFileAttribute _
Inherits Attribute
Dim instance As AssemblyKeyFileAttribute
[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
/** @attribute AttributeUsageAttribute(AttributeTargets.Assembly, Inherited = false) */
/** @attribute ComVisibleAttribute(true) */
public final class AssemblyKeyFileAttribute extends Attribute
public final class AssemblyKeyFileAttribute extends Attribute
厳密な名前を付けたアセンブリを構築する場合は、この属性または AssemblyKeyNameAttribute のいずれかを指定する必要があります。AssemblyDelaySignAttribute も指定した場合は、通常このファイルは公開キーだけを格納します。
たとえば、構文は [assembly:AssemblyKeyFileAttribute("myKey.snk")] のようになります。
注意 : |
|---|
パスとファイル名は永続化されるため、AssemblyKeyFileAttribute で使用する文字列に、機密情報を使用しないでください。 |
AssemblyDelaySignAttribute 属性と AssemblyKeyFileAttribute を使用するコード例を次に示します。この例をコンパイルするには、厳密名ツール (Sn.exe) を使用して、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
using System;
using System.Reflection;
[assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")]
[assembly:AssemblyDelaySignAttribute(true)]
namespace DelaySign
{
public class Test { }
}
using namespace System;
using namespace System::Reflection;
[assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")];
[assembly:AssemblyDelaySignAttribute(true)];
namespace DelaySign
{
public ref class Test { };
}
System..::.Object
System..::.Attribute
System.Reflection..::.AssemblyKeyFileAttribute
この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
.NET Framework
サポート対象 : 3.5、3.0、2.0、1.1、1.0
.NET Compact Framework
サポート対象 : 3.5、2.0、1.0
XNA Framework
サポート対象 : 2.0、1.0
参照
その他の技術情報