getsentry / getsentry/sentry-dotnet

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

Open
#3,536 9 comments 1 reaction 0 assignees View on GitHub
.NET Bug Question
Dominant language
C#
Stars
770
Forks
248
Avg merge
3d 4h
Merged PRs (30d)
49

Description

### 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:

```xml
true
true
```
3. Build the new release

`Nerdbank.GitVersioning` adds code at compile time:

```csharp
#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: ExampleApp@2.2.0.0
Creating Sentry Release: ExampleApp@2.2.0.0
Created release ExampleApp@2.2.0.0
Setting Sentry commits
+------------------------------+--------------+
| Repository | Revision |
+------------------------------+--------------+
| ExampleApp | 428ce4f05351 |
+------------------------------+--------------+
```

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.