Naming and Signing Assemblies

Assemblies are identified with a four-part name, consisting of:

  • The simple name of the assembly

  • The version number of the assembly

  • An optional originator public key (and associated digital signature)

  • An optional set of culture information

The assembly’s simple name is defined in the assembly manifest, and is generally the same as the name of the module that contains the manifest, minus the extension (i.e., the simple name for the assembly MyAssembly.dll is MyAssembly).

The assembly’s version number is divided into four parts and looks like this:

<major>.<minor>.<build>.<revision>

The System.Reflection.AssemblyVersionAttribute assembly-level custom attribute allows you to specify either a full or partial version number for the assembly, as well as allowing you to have the <build> and <revision> portions of the version number automatically change for each build. For example, apply the following custom attribute to an assembly:

using System.Reflection;
[assembly:AssemblyVersion("1.0.0.*")]

This results in an assembly in which the revision number is different every time the assembly is compiled. This represents the number of seconds since midnight, divided by two, since the day the assembly was built.

Assemblies can also be digitally signed using public-key technology to identify the developer (known as the “originator”) and to detect tampering with the assembly after it has been signed. When an assembly is signed, an eight-byte originator ID (known as a public-key ...

Get C# in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.