I am developing a .NET 6
web application and I have a requirement to set the ProductVersion
(or, if that is impossible, at least FileVersion
) of the assembly to a custom string, like shown here:
However, I can't figure out how to do it. All the versioning properties I see in the .csproj file seem to expect a specific numeric format like x.y.z
or something similar.
Is there a way to do this in the .csproj
file, without having to patch the final compiled assembly?
It seems that InformationalVersion
is mapped to ProductVersion
:
<PropertyGroup>
<InformationalVersion>1.24asdds</InformationalVersion>
</PropertyGroup>
Result:
If you are using .NET 8 SDK to build - do not forget to set IncludeSourceRevisionInInformationalVersion
to false
:
<PropertyGroup>
<InformationalVersion>1.24asdds</InformationalVersion>
<IncludeSourceRevisionInInformationalVersion>
false
</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>