Hello everyone, I have a question of understanding.
I have written a mini program that outputs the version information. (its in a local git repro without remote)
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.7-dev"
}
static void Main(string[] args)
{
Console.WriteLine(ThisAssembly.AssemblyVersion);
Console.WriteLine(ThisAssembly.AssemblyFileVersion);
Console.WriteLine(ThisAssembly.AssemblyInformationalVersion);
Console.WriteLine(ThisAssembly.GitCommitId);
Console.WriteLine(ThisAssembly.GitCommitDate);
Console.WriteLine($"PublicRelease {ThisAssembly.IsPublicRelease}");
Console.WriteLine($"Prerelease {ThisAssembly.IsPrerelease}");
}
If I build and execute normally, I get the following output:
I expected that if I build it with the switch PublicRelease that there is no CommitId in the version number.
But the CommitId still appears there. Am I doing something wrong? Or is that supposed to be so? How do I get the CommitId out of the version number?
Sorry for the beginner question, but as far as I've studied the docs, I'm not getting any smarter.
Maybe someone can give me the crucial clue.
Thanks kl1mm
The commit id automatically falls out of package versions for public releases.
But the commit ID is always included in the AssemblyInformationalVersion value because that's a free-form string where you can load whatever version information that will help you down the road. The customer doesn't see this, nor do users of your library unless they explicitly use a decompiler to look for that assembly attribute (or reflection). It's just for your benefit, so we make it as precise as possible.
Most helpful comment
The commit id automatically falls out of package versions for public releases.
But the commit ID is always included in the
AssemblyInformationalVersionvalue because that's a free-form string where you can load whatever version information that will help you down the road. The customer doesn't see this, nor do users of your library unless they explicitly use a decompiler to look for that assembly attribute (or reflection). It's just for your benefit, so we make it as precise as possible.