AssemblyName.SetPublicKey Method (Byte[])

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Sets the public key identifying the assembly.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

member SetPublicKey : 
        publicKey:byte[] -> unit

Parameters

publicKey
Type: System.Byte[]

A byte array containing the public key of the assembly.

You must also use the SetPublicKeyToken method to provide a public key token. Otherwise, a SecurityException is thrown when the GetPublicKey method is called.

The following example emits a dynamic assembly and saves it to the current directory. When the assembly is created, the SetPublicKey method is used to give the assembly a public key. The GetPublicKey method is then used to retrieve the public key, which is displayed to the console.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: