AssemblyKeyFileAttribute Classe

Definizione

Specifica il nome di un file contenente la coppia di chiavi utilizzata per generare un nome sicuro.

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
Ereditarietà
AssemblyKeyFileAttribute
Attributi

Esempio

Nell'esempio di codice seguente viene illustrato l'uso dell'attributo AssemblyDelaySignAttribute con .AssemblyKeyFileAttribute Per compilare questo esempio, è necessario creare un file di chiave con nome sicuro denominato TestPublicKey.snk usando il Sn.exe (Strumento nome sicuro):

sn -k TestPublicKey.snk

Compilare l'esempio come .dll. Se si esegue la compilazione dalla riga di comando, usare l'opzione /t:library .

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

Commenti

Quando si compila un assembly con nome sicuro, l'autore deve fornire questo attributo o AssemblyKeyNameAttribute. Se AssemblyDelaySignAttribute è stato specificato anche , è probabile che questo file conterrà solo la chiave pubblica.

Un esempio della sintassi è [assembly:AssemblyKeyFileAttribute("myKey.snk")].

Caution

Poiché il percorso e il nome del file vengono mantenuti, assicurarsi che la stringa usata con AssemblyKeyFileAttribute non contenga informazioni riservate.

Costruttori

Nome Descrizione
AssemblyKeyFileAttribute(String)

Inizializza una nuova istanza della AssemblyKeyFileAttribute classe con il nome del file contenente la coppia di chiavi per generare un nome sicuro per l'assembly da attribuire.

Proprietà

Nome Descrizione
KeyFile

Ottiene il nome del file contenente la coppia di chiavi utilizzata per generare un nome sicuro per l'assembly con attributi.

TypeId

Se implementato in una classe derivata, ottiene un identificatore univoco per questo Attribute.

(Ereditato da Attribute)

Metodi

Nome Descrizione
Equals(Object)

Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato.

(Ereditato da Attribute)
GetHashCode()

Restituisce il codice hash per questa istanza.

(Ereditato da Attribute)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
IsDefaultAttribute()

Quando sottoposto a override in una classe derivata, indica se il valore di questa istanza è il valore predefinito per la classe derivata.

(Ereditato da Attribute)
Match(Object)

Quando sottoposto a override in una classe derivata, restituisce un valore che indica se questa istanza è uguale a un oggetto specificato.

(Ereditato da Attribute)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Implementazioni dell'interfaccia esplicita

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

Esegue il mapping di un set di nomi a un set corrispondente di identificatori dispatch.

(Ereditato da Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera le informazioni sul tipo per un oggetto, che può essere utilizzato per ottenere le informazioni sul tipo per un'interfaccia.

(Ereditato da Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Recupera il numero di interfacce di informazioni sul tipo fornite da un oggetto (0 o 1).

(Ereditato da Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornisce l'accesso alle proprietà e ai metodi esposti da un oggetto .

(Ereditato da Attribute)

Si applica a

Vedi anche