Kodefabrikken.GetBuildNumber
1.0.0
dotnet add package Kodefabrikken.GetBuildNumber --version 1.0.0
NuGet\Install-Package Kodefabrikken.GetBuildNumber -Version 1.0.0
<PackageReference Include="Kodefabrikken.GetBuildNumber" Version="1.0.0" />
<PackageVersion Include="Kodefabrikken.GetBuildNumber" Version="1.0.0" />
<PackageReference Include="Kodefabrikken.GetBuildNumber" />
paket add Kodefabrikken.GetBuildNumber --version 1.0.0
#r "nuget: Kodefabrikken.GetBuildNumber, 1.0.0"
#addin nuget:?package=Kodefabrikken.GetBuildNumber&version=1.0.0
#tool nuget:?package=Kodefabrikken.GetBuildNumber&version=1.0.0
Get build number
This is a simple tool for setting the build number, the last two numbers, in assembly property FileVersion when running MSBuild. Whatever first two numbers are predefined in FileVersion is kept. These normally corresponds to major and minor version of the built file.
How it works
If environment variable BUILD_BUILDNUMBER is set, e.g. in an Azure pipeline, then that value is used. Otherwise a number is created from properties BuildNumber and BuildRevision - which is also created by this tool.
This override of FileVersion is not performed when building inside Visual Studio unless the property SetBuildNumber is set in the project file. The FileVersion also has to be on the form x.y.0 or x.y.0.0, else the predefined numbers are kept.
BuildNumber is the number of days since 1th of January 2025, and BuildRevision is the number of seconds since midnight divided by two. Kind of the same logic used by Visual Studio when using the x.y.* pattern in project settings and setting Deterministic to false.
The values are generated before target BeforeBuild, and in UTC time.
Why
When building a project with a lot of files it is helpfull to keep track of the individual files that has been changed between each build. FileVersion is then use for that, while AssemblyVersion is used more for keeping track of breaking vs non-breaking changes and releases. If coupled with build tools like GitVersion you get a complete automated system.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Build.Utilities.Core (>= 17.12.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 99 | 2/23/2025 |
Initial release