Version Class

Represents the version number for a common language runtime assembly. This class cannot be inherited.

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

public ref class Version sealed : ICloneable, IComparable, IComparable<Version^>, 
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class Version implements ICloneable, IComparable, 
	IComparable<Version>, IEquatable<Version>
public final class Version implements ICloneable, IComparable, 
	IComparable<Version>, IEquatable<Version>
Not applicable.

Use a Version object to store and compare the version number of an assembly. Note that you or an application can set a Version object to the version number of an assembly. However, a Version object is not automatically set to the version number of any particular assembly, and the Version class has no members that can acquire such information.

Version numbers consist of two to four components: major, minor, build, and revision. The major and minor components are required; the build and revision components are optional, but the build component is required if the revision component is defined. All defined components must be integers greater than or equal to 0. The format of the version number is as follows. Optional components are shown in square brackets ('[' and ']'):


The components are used by convention as follows:

  • Major : Assemblies with the same name but different major versions are not interchangeable. This would be appropriate, for example, for a major rewrite of a product where backward compatibility cannot be assumed.

  • Minor : If the name and major number on two assemblies are the same, but the minor number is different, this indicates significant enhancement with the intention of backward compatibility. This would be appropriate, for example, on a point release of a product or a fully backward compatible new version of a product.

  • Build : A difference in build number represents a recompilation of the same source. This would be appropriate because of processor, platform, or compiler changes.

  • Revision : Assemblies with the same name, major, and minor version numbers but different revisions are intended to be fully interchangeable. This would be appropriate to fix a security hole in a previously released assembly.

Subsequent versions of an assembly that differ only by build or revision numbers are considered to be Hotfix updates of the prior version.

Starting with .NET Framework 2.0, the MajorRevision and MinorRevision properties enable you to identify a temporary version of your application that, for example, corrects a problem until you can release a permanent solution. Furthermore, the Windows NT operating system uses the MajorRevision property to encode the service pack number.

This class implements the ICloneable, IComparable, IComparable, and IEquatable interfaces.

The following code example uses the Assembly class to obtain the Version object that identifies an assembly.

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

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions