We recommend using Visual Studio 2017

CA1016: Mark assemblies with AssemblyVersionAttribute


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CA1016: Mark assemblies with AssemblyVersionAttribute.

|Breaking Change|Non-breaking|

The assembly does not have a version number.

The identity of an assembly is composed of the following information:

  • Assembly name

  • Version number

  • Culture

  • Public key (for strongly named assemblies).

The .NET Framework uses the version number to uniquely identify an assembly, and to bind to types in strongly named assemblies. The version number is used together with version and publisher policy. By default, applications run only with the assembly version with which they were built.

To fix a violation of this rule, add a version number to the assembly by using the System.Reflection.AssemblyVersionAttribute attribute. See the following example.

Do not suppress a warning from this rule for assemblies that are used by third parties, or in a production environment.

The following example shows an assembly that has the AssemblyVersionAttribute attribute applied.

using System;
using System.Reflection;

[assembly: AssemblyVersionAttribute("")]
namespace DesignLibrary {}

Assembly Versioning
How to: Create a Publisher Policy