sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

`SentryCreateRelease` not using `AssemblyInformationalVersion` from `Nerdbank.GitVersioning`

Open meenzen opened this issue 6 months ago • 9 comments

Package

Sentry.AspNetCore

.NET Flavor

.NET

.NET Version

8.0.400

OS

Linux

SDK Version

4.10.0

Self-Hosted Sentry Version

24.7.1

Steps to Reproduce

  1. Have an existing project that uses Nerdbank.GitVersioning

  2. Enable the new features by adding these properties to the project config:

    <SentryCreateRelease>true</SentryCreateRelease>
    <SentrySetCommits>true</SentrySetCommits>
    
  3. Build the new release

Nerdbank.GitVersioning adds code at compile time:

#pragma warning disable CA2243

[assembly: System.Reflection.AssemblyVersionAttribute("2.2.0.0")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.2.0-alpha.1231+d4b08efa99")]
#if NETSTANDARD || NETFRAMEWORK || NETCOREAPP
[System.CodeDom.Compiler.GeneratedCode("Nerdbank.GitVersioning.Tasks","3.6.141.978")]
#endif
#if NET40_OR_GREATER || NETCOREAPP2_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
#endif
internal static partial class ThisAssembly {
    internal const string AssemblyConfiguration = "Debug";
    internal const string AssemblyFileVersion = "2.2";
    internal const string AssemblyInformationalVersion = "2.2.0-alpha.1231+d4b08efa99";
    internal const string AssemblyName = "ExampleApp";
    internal const string AssemblyTitle = "ExampleApp";
    internal const string AssemblyVersion = "2.2.0.0";
    internal static readonly System.DateTime GitCommitDate = new System.DateTime(638593071050000000L, System.DateTimeKind.Utc);
    internal const string GitCommitId = "d4b08efa99564ae8a294e3f8888a1292f06adab7";
    internal const bool IsPrerelease = true;
    internal const bool IsPublicRelease = true;
    internal const string RootNamespace = "ExampleApp";
}

Expected Result

The version from the AssemblyInformationalVersionAttribute is being used to create the release

The following code suggests this should work: https://github.com/getsentry/sentry-dotnet/pull/3462/files#diff-14707e966a1fc6c249c6ab6fb17b0aac9349add0d80942b4710d96f7af1f0217R278

Actual Result

A release using the AssemblyVersion is created:

  Getting Sentry Release...
  Sentry Release: [email protected]
  Creating Sentry Release: [email protected]
  Created release [email protected]
  Setting Sentry commits
  +------------------------------+--------------+
  | Repository                   | Revision     |
  +------------------------------+--------------+
  | ExampleApp                   | 428ce4f05351 |
  +------------------------------+--------------+

I have not tested this without Nerdbank.GitVersioning but something is obviously wrong here.

meenzen avatar Aug 15 '24 09:08 meenzen