Featured image of post Remove git hash from assembly informational version in .NET 8

Remove git hash from assembly informational version in .NET 8

Since the .NET 8 SDK, the assembly's info version includes the git commit hash. Here's how to disable this feature.

If you build your .NET projects with the .NET 8 SDK, you may have noticed that the assembly informational version now includes the git hash of the associated commit:

var informationalVersion = typeof(Program).Assembly


// Prints something like
// 1.0.0+9aa8e4c69145f5b7b4b59c93f2a1ee5ea19b79f9

This is a breaking change in the .NET 8 SDK, which now includes Source Link by default. Source Link allows packages and applications to embed information about the source control of generated artifacts. This affects any target framework, as long as the code is compiled with the .NET 8 SDK.

If you had logic that uses the assembly informational version, it might not work at all anymore. To opt out of this feature, you need to add the following property in your .csproj file:

Licensed under CC BY 4.0
Ko-fi donations Buy me a coffee