Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
AssemblyName Class
Collapse the table of content
Expand the table of content

AssemblyName Class

Describes an assembly's unique identity in full.

For a list of all members of this type, see AssemblyName Members.


[Visual Basic]
NotInheritable Public Class AssemblyName
   Implements ICloneable, ISerializable, IDeserializationCallback
public sealed class AssemblyName : ICloneable, ISerializable,
public __gc __sealed class AssemblyName : public ICloneable,
   ISerializable, IDeserializationCallback
class AssemblyName implements ICloneable, ISerializable,

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


The assembly cache manager uses AssemblyName objects for binding and retrieving information about an assembly. An assembly's identity consists of a simple name, a version number, a cryptographic key pair, and a supported culture. The simple name is the unencrypted name, as distinguished from the strong name. The strong name is an assembly name with a public and private cryptographic key pair that helps protect it.

All compilers that support the common language runtime will emit the simple name of a nested class, and reflection constructs a mangled name when queried, in accordance with the following conventions.

Delimiter Meaning
Backslash (\) Escape character.
Comma (,) Precedes the Assembly name.
Plus sign (+) Precedes a nested class.
Period (.) Denotes namespace identifiers.

For example, the fully qualified name for a class might look like this:


If the namespace were TopNamespace.Sub+Namespace, then the string would have to precede the plus sign (+) with an escape character (\) to prevent it from being interpreted as a nesting separator. Reflection emits this string as follows:


A "++" becomes "\+\+", and a "\" becomes "\\".

This qualified name can be persisted and later used to load the Type. To search for and load a Type, use GetType either with the type name only or with the assembly qualified type name. GetType with the type name only will look for the Type in the caller's assembly and then in the System assembly. GetType with the assembly qualified type name will look for the Type in any assembly.

Type names may include trailing characters that denote additional information about the type, such as whether the type is a reference type, a pointer type or an array type. To retrieve the type name without these trailing characters, use t.GetElementType().ToString(), where t is the type.

Spaces are relevant in all type name components except the assembly name. In the assembly name, spaces before the ',' separator are relevant, but spaces after the ',' separator are ignored.

A fully specified AssemblyName must have, in this order, the name, culture, public key or public key token, major version, minor version, build number, and revision number parameters. The last four are packaged in the Version type. However, an AssemblyName may specify a partial query when an insufficient number of parameters is supplied to explicitly determine a unique assembly. The assembly cache manager returns the first assembly that matches the specified AssemblyName. The parameter order for partial assembly name references must be the order specified above. For example, you may specify and match on the name, culture, and public key or public key token with the version parameters omitted, but you may not match on the name and public key or public key token, omitting both the culture and the version. When used for binding, the name is the minimum requirement.

To create a simple name, create an AssemblyName object using the default constructor and set the Name. The other properties are optional.

To create a full strong name, create an AssemblyName object using the default constructor and set the Name and KeyPair. The other properties are optional. Use SetPublicKey and SetPublicKeyToken to set the public key and the strong name. The strong name signing always uses the SHA1 hash algorithm.

For a partially specified strong name, create an AssemblyName object using the default constructor and set the name and public key. The other properties are optional. An assembly created using such an AssemblyName can be signed later using the Assembly Linker (Al.exe).

It is possible to specify a public key and a KeyPair with inconsistent values. This can be useful in developer scenarios. In this case, the public key retrieved with GetPublicKey specifies the correct public key, while the KeyPair specifies the public and private keys used during development. When the runtime detects a mismatch between the KeyPair and the public key, it looks up in the registry the correct key that matches the public key.

The format of the display name of an AssemblyName is a comma-delimited Unicode string that begins with the name, as follows: Name <,Culture =

CultureInfo> <,Version =

Major.Minor.Build.Revision> <, StrongName>

<,PublicKeyToken> '\0'

Name is the textual name of the assembly. CultureInfo is the RFC1766-format-defined culture. Major, Minor, Build, and Revision are the major version, minor version, build number, and revision number of the assembly. StrongName is the hexadecimal-encoded low-order 64 bits of the hash value of the public key generated using the SHA-1 hashing algorithm and the public key specified by SetPublicKey. PublicKeyToken is the hexadecimal-encoded public key specified by SetPublicKey.

Quoted values are optional. Hexadecimal encoding is defined as the conversion of each byte of a binary object to two hexadecimal characters, progressing from least to most significant byte. Additional display values will be added as deemed necessary.

If the full public key is known, then PublicKey may be substituted for StrongName.

Also note that except for Name, which must come first, the lexical order of parameters is unimportant. However, any parameter (Version, Culture, StrongName or PublicKey) not specifically set is considered to be omitted, and the AssemblyName is then considered partial. When specifying partial information, Name parameters must be specified in the order described above.

When supplying a display name, the convention StrongName =null or PublicKey= null indicates that binding and matching against a simply named assembly is required. Additionally, the convention Culture= "" (double quote representing an empty string) indicates matching against the default culture.

The following code example shows an AssemblyName for a simply named assembly with default culture.



The following code example shows a fully specified reference for a strongly named assembly with culture "en".

com.microsoft.crypto, Culture=en, PublicKeyToken=a5d015c7d5a0b012, Version=

The following code examples each show a partially specified AssemblyName, which can be satisfied by either a strong or a simply named assembly.


com.microsoft.crypto, Culture=""

com.microsoft.crypto, Culture=en

The following code examples each show a partially specified AssemblyName, which must be satisfied by a simply named assembly.

com.microsoft.crypto, Culture="", PublicKeyToken=null

com.microsoft.crypto, Culture=en, PublicKeyToken=null

The following code examples each show a partially specified AssemblyName, which must be satisfied by a strongly named assembly.

com.microsoft.crypto, Culture="", PublicKeyToken=a5d015c7d5a0b012

com.microsoft.crypto, Culture=en, PublicKeyToken=a5d015c7d5a0b012, Version=


Namespace: System.Reflection

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

AssemblyName Members | System.Reflection Namespace | Version | GetPublicKey | GetPublicKeyToken | SetPublicKey | SetPublicKeyToken | FullName | GetType | AssemblyQualifiedName | Specifying Fully Qualified Type Names

© 2015 Microsoft