.NET
versioning
assembly
AssemblyVersion
AssemblyFileVersion

AssemblyVersion vs AssemblyFileVersion vs AssemblyInformationalVersion

Codemia Knowledge Hub ·

AssemblyVersion is the version the .NET runtime uses for binding and strong-name resolution. AssemblyFileVersion is what Windows shows in file properties and is used for build tracking. AssemblyInformationalVersion is a free-form string for the human-readable product version, such as 2.1.0-beta.3. Knowing when to change each one prevents binding failures, stale cache hits and confusing release labels.

AssemblyVersion: the runtime identity

AssemblyVersion is embedded in the assembly manifest and used during strong-name binding. When an application is compiled against version 1.0.0.0 of a strong-named assembly, the runtime refuses to load version 2.0.0.0 at run time unless a binding redirect is in place.

csharp
1// In AssemblyInfo.cs (classic .NET Framework)
2[assembly: AssemblyVersion("1.0.0.0")]
3
4// In .csproj (SDK-style projects)
5<PropertyGroup>
6    <AssemblyVersion>1.0.0.0</AssemblyVersion>
7</PropertyGroup>
  • Format: strictly Major.Minor.Build.Revision, all numeric. Wildcards like 1.0.* are allowed in classic projects and make the compiler generate build and revision numbers.
  • Binding impact: changing AssemblyVersion on a strong-named assembly is a breaking change. Every consumer must recompile or add a binding redirect.
  • Default: if omitted in an SDK-style project, it is 1.0.0.0.

Because a change forces every consumer to update, the common practice is to change AssemblyVersion only for major or breaking releases and keep it stable across minor updates and patches.

AssemblyFileVersion: the build identifier

AssemblyFileVersion maps to the Win32 file version resource and appears on the "Details" tab of file properties in Windows. The runtime does not use it for binding or loading, so changing it never breaks consumers.

csharp
1// In AssemblyInfo.cs
2[assembly: AssemblyFileVersion("1.2.345.0")]
3
4// In .csproj
5<PropertyGroup>
6    <FileVersion>1.2.345.0</FileVersion>
7</PropertyGroup>
  • Format: the same four-part numeric format as AssemblyVersion.
  • No binding impact: consumers do not need to recompile.
  • Common use: incremented on every CI build. The build number or commit counter often goes in the third or fourth position, so each binary has a unique, traceable identifier.

If AssemblyFileVersion is not specified, it defaults to the value of AssemblyVersion.

AssemblyInformationalVersion: the product label

AssemblyInformationalVersion is a free-form display string. It can hold semantic version suffixes, branch names or commit hashes. NuGet uses it as the package version when no explicit PackageVersion is set.

csharp
1// In AssemblyInfo.cs
2[assembly: AssemblyInformationalVersion("2.1.0-beta.3+build.482")]
3
4// In .csproj
5<PropertyGroup>
6    <InformationalVersion>2.1.0-beta.3+build.482</InformationalVersion>
7</PropertyGroup>
  • Format: no restrictions. Letters, digits, hyphens, dots and plus signs are all valid, so strings like 1.0.0-rc.1+sha.abc1234 fit naturally.
  • No binding impact: the runtime ignores this attribute.
  • Visible in: Application.ProductVersion in WinForms, FileVersionInfo.ProductVersion in reflection, and the "Product version" field in Windows file properties.

If not specified, it defaults to the value of AssemblyVersion.

Side-by-side comparison

AttributeFormatUsed by RuntimeAffects BindingCommon Change FrequencyVisible In
AssemblyVersionMajor.Minor.Build.Revision (numeric)YesYes (strong name)Major releases onlyAssembly manifest, GAC
AssemblyFileVersionMajor.Minor.Build.Revision (numeric)NoNoEvery buildWindows file properties
AssemblyInformationalVersionFreeform stringNoNoEvery releaseNuGet, product dialogs

Versioning strategies

Lock AssemblyVersion, increment the others

This minimizes binding pain. AssemblyVersion stays at 1.0.0.0 across all 1.x releases, AssemblyFileVersion increments with each build, and AssemblyInformationalVersion carries the semantic version.

xml
1<PropertyGroup>
2    <AssemblyVersion>1.0.0.0</AssemblyVersion>
3    <FileVersion>1.3.$(BuildNumber).0</FileVersion>
4    <InformationalVersion>1.3.0-preview.2</InformationalVersion>
5</PropertyGroup>

Many large .NET libraries use this strategy, including Newtonsoft.Json.

Increment all three together

Setting only the <Version> property is simpler to reason about, but it creates binding redirect overhead for strong-named assemblies. It works well for applications (EXEs) with no external consumers.

xml
1<PropertyGroup>
2    <Version>2.4.1</Version>
3    <!-- This sets all three attributes to 2.4.1 -->
4</PropertyGroup>

CI-driven with commit metadata

CI pipelines often stamp the informational version with the Git commit hash for full traceability:

xml
1<PropertyGroup>
2    <AssemblyVersion>3.0.0.0</AssemblyVersion>
3    <FileVersion>3.1.$(BuildId).0</FileVersion>
4    <InformationalVersion>3.1.0+sha.$(GitCommitHash)</InformationalVersion>
5</PropertyGroup>

Reading the three versions at runtime

csharp
1using System.Diagnostics;
2using System.Reflection;
3
4var assembly = typeof(Program).Assembly;
5
6// AssemblyVersion
7var asmVersion = assembly.GetName().Version;
8Console.WriteLine($"AssemblyVersion: {asmVersion}");
9
10// AssemblyFileVersion
11var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
12Console.WriteLine($"FileVersion: {fileVersionInfo.FileVersion}");
13
14// AssemblyInformationalVersion
15var infoVersion = assembly
16    .GetCustomAttribute<AssemblyInformationalVersionAttribute>()
17    ?.InformationalVersion;
18Console.WriteLine($"InformationalVersion: {infoVersion}");

This is useful for logging the exact build running in production or showing version details in an "About" dialog.

How SDK-style project properties map to attributes

MSBuild PropertyAssembly AttributeFalls Back To
<AssemblyVersion>AssemblyVersionAttribute1.0.0.0
<FileVersion>AssemblyFileVersionAttributeAssemblyVersion value
<InformationalVersion>AssemblyInformationalVersionAttributeAssemblyVersion value
<Version>Sets all three if individual properties are not specified1.0.0

<Version> is a shortcut. Setting <Version>2.0.0</Version> populates all three attributes, but any individually specified property takes precedence.

Versioning mistakes to avoid

Incrementing AssemblyVersion on every build of a strong-named assembly. Every consumer then has to recompile or add binding redirects on each release. Keep AssemblyVersion stable within a major version and increment FileVersion instead.

Confusing AssemblyVersion with the NuGet package version. NuGet uses AssemblyInformationalVersion (or the <Version> property) for the package version. A library with AssemblyVersion 1.0.0.0 and InformationalVersion 1.5.0 publishes as NuGet version 1.5.0.

Omitting FileVersion in CI builds. It then defaults to AssemblyVersion, so two builds of the same assembly version are indistinguishable. Include a build number in FileVersion.

Putting non-numeric text in AssemblyVersion. 1.0.0-beta in AssemblyVersion causes a build error. Pre-release labels belong in InformationalVersion.

Keeping AssemblyInfo.cs without setting GenerateAssemblyInfo to false. SDK-style projects generate assembly attributes automatically, so a manual AssemblyInfo.cs produces duplicate attribute errors. Delete the file or set <GenerateAssemblyInfo>false</GenerateAssemblyInfo>.


Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms