Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@plioi
Copy link
Contributor

@plioi plioi commented Nov 30, 2023

Historically, although our packaging worked, it became confused over time by shifting guidance and available tooling. All packaged assemblies used <DebugType>embedded<DebugType>, which makes the most sense when you are not publishing a separate symbols package, but we were attempting to publish such a package. The symbols package we were building, however, was of the legacy format, so it was not actually taking part. This undesirable combination worked for end users, though, since the embedded symbol data made up for the missing symbol package.

Additionally, we stand to benefit from enabling deterministic builds during CI, now that .NET 8 applies Source Link automatically and is better served by leveraging this optional feature.

This modernizes our packages to the latest guidance in the .NET 8 era:

  • Publish a separate symbols package, using the modern supported snupkg format.
  • Avoid redundantly embedding symbols in the dlls.
  • Enable "Deterministic Builds" at CI time.
  • Capture evidence of the overall impact here in this description.

Note that this change results in an incorrect warning from NuGet during dotnet pack, complaining that the TestAdapter package is missing its README. This is simply not the case, and the incorrect warning text appears to be an unintentional side effect of the atypical combination of modern symbols packaging with an old fashioned nuspec. The README is included in the package.

Packaging Status Before This PR

(Obtained with dotnet build src/$project -c Release --nologo --getProperty:$property and dotnet validate package local $package)

Project: Fixie
Deterministic: true
ContinuousIntegrationBuild:
EmbedUntrackedSources: true
DebugType: embedded
IncludeSymbols: true
SymbolPackageFormat: symbols.nupkg

Validating /home/runner/work/fixie/fixie/packages/Fixie.3.3.1-alpha.0.17.nupkg
• Source Link: ✅ Valid

• Deterministic (dll/exe): ❌ Non deterministic
    Ensure that the following property is enabled for CI builds
    and you're using at least the 2.1.300 SDK:
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    The following assemblies have not been compiled with deterministic settings:
    lib\net6.0\Fixie.dll
    lib\net7.0\Fixie.dll
    lib\net8.0\Fixie.dll
    lib\netcoreapp3.1\Fixie.dll

• Compiler Flags: ✅ Valid

Validating /home/runner/work/fixie/fixie/packages/Fixie.3.3.1-alpha.0.17.symbols.nupkg
• Source Link: ✅ Valid

• Deterministic (dll/exe): ❌ Non deterministic
    Ensure that the following property is enabled for CI builds
    and you're using at least the 2.1.300 SDK:
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    The following assemblies have not been compiled with deterministic settings:
    lib\net6.0\Fixie.dll
    lib\net7.0\Fixie.dll
    lib\net8.0\Fixie.dll
    lib\netcoreapp3.1\Fixie.dll

• Compiler Flags: ✅ Valid
Project: Fixie.Console
Deterministic: true
ContinuousIntegrationBuild:
EmbedUntrackedSources: true
DebugType: embedded
IncludeSymbols: true
SymbolPackageFormat: symbols.nupkg

Validating /home/runner/work/fixie/fixie/packages/Fixie.Console.3.3.1-alpha.0.17.nupkg
• Source Link: ✅ Valid

• Deterministic (dll/exe): ❌ Non deterministic
    Ensure that the following property is enabled for CI builds
    and you're using at least the 2.1.300 SDK:
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    The following assemblies have not been compiled with deterministic settings:
    tools\netcoreapp3.1\any\Fixie.Console.dll

• Compiler Flags: ✅ Valid

Validating /home/runner/work/fixie/fixie/packages/Fixie.Console.3.3.1-alpha.0.17.symbols.nupkg
• Source Link: ✅ Valid

• Deterministic (dll/exe): ❌ Non deterministic
    Ensure that the following property is enabled for CI builds
    and you're using at least the 2.1.300 SDK:
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    The following assemblies have not been compiled with deterministic settings:
    tools\netcoreapp3.1\any\Fixie.Console.dll

• Compiler Flags: ✅ Valid
Project: Fixie.TestAdapter
Deterministic: true
ContinuousIntegrationBuild:
EmbedUntrackedSources: true
DebugType: embedded
IncludeSymbols: true
SymbolPackageFormat: symbols.nupkg

Validating /home/runner/work/fixie/fixie/packages/Fixie.TestAdapter.3.3.1-alpha.0.17.nupkg
• Source Link: ✅ Valid

• Deterministic (dll/exe): ❌ Non deterministic
    Ensure that the following property is enabled for CI builds
    and you're using at least the 2.1.300 SDK:
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    The following assemblies have not been compiled with deterministic settings:
    lib\net6.0\Fixie.TestAdapter.dll
    lib\net7.0\Fixie.TestAdapter.dll
    lib\net8.0\Fixie.TestAdapter.dll
    lib\netcoreapp3.1\Fixie.TestAdapter.dll

• Compiler Flags: ✅ Valid

Validating /home/runner/work/fixie/fixie/packages/Fixie.TestAdapter.3.3.1-alpha.0.17.symbols.nupkg
• Source Link: ✅ Valid

• Deterministic (dll/exe): ❌ Non deterministic
    Ensure that the following property is enabled for CI builds
    and you're using at least the 2.1.300 SDK:
    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    The following assemblies have not been compiled with deterministic settings:
    lib\net6.0\Fixie.TestAdapter.dll
    lib\net7.0\Fixie.TestAdapter.dll
    lib\net8.0\Fixie.TestAdapter.dll
    lib\netcoreapp3.1\Fixie.TestAdapter.dll

• Compiler Flags: ✅ Valid
Project: Fixie.Tests
Deterministic: true
ContinuousIntegrationBuild:
EmbedUntrackedSources: true
DebugType: embedded
IncludeSymbols: true
SymbolPackageFormat: symbols.nupkg

Packaging Status After This PR

Project: Fixie
Deterministic: true
ContinuousIntegrationBuild: true
EmbedUntrackedSources: true
DebugType: portable
IncludeSymbols: true
SymbolPackageFormat: snupkg

Validating /home/runner/work/fixie/fixie/packages/Fixie.3.3.1-alpha.0.17.nupkg
• Source Link: ✅ Valid with Symbol Server
• Deterministic (dll/exe): ✅ Valid
• Compiler Flags: ✅ Valid
Project: Fixie.Console
Deterministic: true
ContinuousIntegrationBuild: true
EmbedUntrackedSources: true
DebugType: portable
IncludeSymbols: true
SymbolPackageFormat: snupkg

Validating /home/runner/work/fixie/fixie/packages/Fixie.Console.3.3.1-alpha.0.17.nupkg
• Source Link: ✅ Valid
• Deterministic (dll/exe): ✅ Valid
• Compiler Flags: ✅ Valid
Project: Fixie.TestAdapter
Deterministic: true
ContinuousIntegrationBuild: true
EmbedUntrackedSources: true
DebugType: portable
IncludeSymbols: true
SymbolPackageFormat: snupkg

Validating /home/runner/work/fixie/fixie/packages/Fixie.TestAdapter.3.3.1-alpha.0.17.nupkg
• Source Link: ✅ Valid with Symbol Server
• Deterministic (dll/exe): ✅ Valid
• Compiler Flags: ✅ Valid
Analyzing Fixie.Tests Properties
Deterministic: true
ContinuousIntegrationBuild: true
EmbedUntrackedSources: true
DebugType: portable
IncludeSymbols: true
SymbolPackageFormat: snupkg

… can get feedback about Source Link and Deterministic Builds.
…ties, so we can get feedback about packaging format/content and Deterministic Builds.
…ministic builds.

This change was suggested by the following output from the `dotnet-validate` package validation tool:

>  Deterministic (dll/exe): ❌ Non deterministic
>    Ensure that the following property is enabled for CI builds
>    and you're using at least the 2.1.300 SDK:
>    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
…not even supported by NuGet.org's symbol server and were redundant in our case due to favoring DebugType 'embedded'.
…ted by NuGet.org's symbol server. Since this places symbols in the symbols package, we stop also embedding them in the dll files, reducing download size for most users.
@plioi plioi force-pushed the modernize-nuget-packages branch from bdfb92d to 9415a44 Compare November 30, 2023 21:55
@plioi plioi marked this pull request as ready for review November 30, 2023 22:08
@plioi plioi merged commit e51e2b7 into main Nov 30, 2023
@plioi plioi deleted the modernize-nuget-packages branch November 30, 2023 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants