AssemblyKeyFileAttribute Klasa

Definicja

Określa nazwę pliku zawierającego parę kluczy używaną do generowania silnej nazwy.

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

Przykłady

Poniższy przykład kodu przedstawia użycie atrybutu AssemblyDelaySignAttribute z atrybutem AssemblyKeyFileAttribute. Aby skompilować ten przykład, należy utworzyć plik klucza o silnej nazwie o nazwie TestPublicKey.snk przy użyciu Sn.exe (narzędzie silnej nazwy):

sn -k TestPublicKey.snk   

Skompiluj przykład jako .dll. W przypadku kompilowania z wiersza polecenia użyj /t:library opcji języka C# lub Visual Basic lub /LD konsolidatora dla języka Visual C++.

using namespace System;
using namespace System::Reflection;

[assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")];
[assembly:AssemblyDelaySignAttribute(true)];

namespace DelaySign
{
    public ref class Test { };
}
using System;
using System.Reflection;

[assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")]
[assembly:AssemblyDelaySignAttribute(true)]

namespace DelaySign
{
    public class Test { }
}
Imports System.Reflection

<assembly:AssemblyDelaySignAttribute(true)>
<assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")>

Namespace DelaySign

    Public class Test
    End Class

End Namespace

Uwagi

Podczas tworzenia zestawu o silnej nazwie autor musi podać ten atrybut lub AssemblyKeyNameAttribute. Jeśli AssemblyDelaySignAttribute został również określony, prawdopodobnie ten plik będzie zawierać tylko klucz publiczny.

Przykładem składni jest [assembly:AssemblyKeyFileAttribute("myKey.snk")].

Przestroga

Ponieważ ścieżka i nazwa pliku są utrwalane, upewnij się, że używany ciąg AssemblyKeyFileAttribute nie zawiera poufnych informacji.

Konstruktory

AssemblyKeyFileAttribute(String)

Inicjuje nowe wystąpienie AssemblyKeyFileAttribute klasy o nazwie pliku zawierającego parę kluczy, aby wygenerować silną nazwę przypisywanego zestawu.

Właściwości

KeyFile

Pobiera nazwę pliku zawierającego parę kluczy użytą do wygenerowania silnej nazwy zestawu przypisanego.

TypeId

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego elementu Attribute.

(Odziedziczone po Attribute)

Metody

Equals(Object)

Zwraca wartość wskazującą, czy to wystąpienie jest równe podanemu obiektowi.

(Odziedziczone po Attribute)
GetHashCode()

Zwraca wartość skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
IsDefaultAttribute()

W przypadku zastąpienia w klasie pochodnej wskazuje, czy wartość tego wystąpienia jest wartością domyślną klasy pochodnej.

(Odziedziczone po Attribute)
Match(Object)

W przypadku zastąpienia w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

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

Zestaw nazw jest mapowany na odpowiedni zestaw identyfikatorów wysyłania.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Pobiera informacje o typie obiektu, którego można użyć do pobrania informacji o typie interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Pobiera informację o liczbie typów interfejsów, jakie zawiera obiekt (0 lub 1).

(Odziedziczone po Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Umożliwia dostęp do właściwości i metod udostępnianych przez obiekt.

(Odziedziczone po Attribute)

Dotyczy

Zobacz też