This documentation is archived and is not being maintained.

AssemblyVersionAttribute Class

Specifies the version of the assembly being attributed.

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


[Visual Basic]
NotInheritable Public Class AssemblyVersionAttribute
   Inherits Attribute
public sealed class AssemblyVersionAttribute : Attribute
public __gc __sealed class AssemblyVersionAttribute : public
class AssemblyVersionAttribute extends Attribute

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 version number is part of an assembly's identity and plays a key part in binding to the assembly and in version policy. The default version policy for the runtime is that applications run only with the versions they were built and tested with, unless overridden by explicit version policy in configuration files (the application configuration file, the publisher policy file, and the computer's administrator configuration file). See Assemblies Overview for more information.

Note   Version checking only occurs with strong-named assemblies.

The version number has four parts, as follows:

<major version>.<minor version>.<build number>.<revision>

You can specify all the values or you can accept the default build number, revision number, or both by using an asterisk (*). For example, [assembly:AssemblyVersion("")] indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number. A version number such as [assembly:AssemblyVersion("1.2.*")] specifies 1 as the major version, 2 as the minor version, and accepts the default build and revision numbers. A version number such as [assembly:AssemblyVersion("1.2.15.*")] specifies 1 as the major version, 2 as the minor version, 15 as the build number, and accepts the default revision number. A version number such as [assembly:AssemblyVersion("1.2.*.6")] specifies 1 as the major version, 2 as the minor version, accepts the default build number, and specifies 6 as the revision number.

The assembly major and minor versions are used as the type library version number when the assembly is exported. Some COM hosts do not accept type libraries with the version number 0.0. Therefore, if you want to expose an assembly to COM clients, set the assembly version explicitly to 1.0 in the AssemblyVersionAttribute page for projects created outside Visual Studio .NET and with no AssemblyVersionAttribute specified. Do this even when the assembly version is 0.0. All projects created in Visual Studio .NET have a default assembly version of 1.0*.

To get the name of an assembly you have loaded, call GetName on the assembly to get an AssemblyName, and then get the Version property. To get the name of an assembly you have not loaded, call GetAssemblyName from your client application to check the assembly version that your application uses.


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

AssemblyVersionAttribute Members | System.Reflection Namespace | Metadata and Self-Describing Components | Compiling to MSIL | Metadata Overview | Assemblies Overview | Version