C
C#12mo ago
Bill

Asssembly Version Wrong

It was working for a little bit, but now it's displaying v1.0.0-alpha+9fb67d6af368e6cd5a05c8f4013272d4a644ca89 instead of v1.0.0-alpha after adding user secrets.
private string? GetVersion()
{
return typeof(Worker).Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion;
}
private string? GetVersion()
{
return typeof(Worker).Assembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion;
}
11 Replies
Bill
BillOP12mo ago
@SyncRооt Seems like we have an issue again
Jimmacle
Jimmacle12mo ago
oh, i ran into this exact problem recently the problem is .NET 8 added new MSBuild tasks that automatically sniff out version control information and force it into your informational version you want to add <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> to your project properties see above i don't know why this was added without announcing it or telling you how to turn it off, i had to sniff around the binlog and dotnet source to figure it out
Bill
BillOP12mo ago
Trying this!
Petris
Petris12mo ago
Breaking change: Source Link included in the .NET SDK - .NET
Learn about a breaking change in the .NET 8 SDK where Source Link is included, and commit information is included in InformationalVersion.
Jimmacle
Jimmacle12mo ago
i didn't see it in the .NET 8 release notes when
Mayor McCheese
Mayor McCheese12mo ago
Actually that's pretty badass
Jimmacle
Jimmacle12mo ago
sure if you didn't already have your informational version set up the way you like it i already had a short hash in mine and had to spend a couple hours figuring out why it suddenly became the full hash
Mayor McCheese
Mayor McCheese12mo ago
I mean fair, I usually use gitversion and my scheme is a bit different I wonder if you can specify the pattern to use
Jimmacle
Jimmacle12mo ago
not that i saw, but i was mostly looking for how to turn it off i set my informational version as the output of git describe --long --tags --always --dirty where my tags are always <major>.<minor>.<patch> so i know the most recent tag, how many commits ahead a build is, and if it was built with a dirty working tree
Petris
Petris12mo ago
for context Source Link is automatically recognized by the VS debugger so it downloads sources for the project when debugging when they're stored in the DLL
Bill
BillOP12mo ago
Is this just for public projects?
Want results from more Discord servers?
Add your server