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

W poniższym przykładzie kodu pokazano użycie atrybutu AssemblyDelaySignAttribute z .AssemblyKeyFileAttribute Aby skompilować ten przykład, należy utworzyć plik klucza o silnej nazwie o nazwie TestPublicKey.snk przy użyciu Sn.exe (strong name tool):

sn -k TestPublicKey.snk   

Skompiluj przykład jako .dll. Jeśli skompilujesz z wiersza polecenia, użyj /t:library opcji dla języka C# lub Visual Basic lub /LD opcji 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 informacji poufnych.

Konstruktory

AssemblyKeyFileAttribute(String)

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

Właściwości

KeyFile

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

TypeId

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego Attributeelementu .

(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 wartość bieżącego wystąpienia.

(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)

Po przesłonięciu 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 dla obiektu, który może służyć do pobierania informacji o typie dla 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ż