Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DebugType as portable, to generate deterministic nupkgs in 1ES #343

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

davidmrdavid
Copy link
Member

@davidmrdavid davidmrdavid commented Sep 18, 2024

While migrating to our new 1ES CI, we realized that the nupkgs generated by this repo were not getting the "deterministic" flag in the NuGet package explorer.

After a lot of experimentation, we discovered the reason for this was that our packages did not set the DebugType MSBuild property to embedded portable which apparently is needed for deterministic builds. The need for this property (and others we were already setting) is explained here: https://www.meziantou.net/creating-reproducible-build-in-dotnet.htm

To be honest, I don't know why previous CI environment still generated deterministic builds, even without this flag. That's a mystery for another day. For now, and to unblock upcoming releases, we'll set the DebugType of our packages to embedded portable to all the expected checkmarks in the NuGet package explorer.

For comparison, here's the view of the NuGet package before this change:

image (1)

and here it is after:

image

Edit 9/18: a previous version of this PR set the DebugType as embedded. I've set it to portable on this date based on this feedback: #343 (comment)

themselves, which is seemingly necessary for having a 'deterministic' build checkmark in our NuGet package.
This is recommended for NuGet packages, as per: https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/
The connection to deterministic builds is explored here: https://www.meziantou.net/creating-reproducible-build-in-dotnet.htm -->
<DebugType>embedded</DebugType>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall that Jacob had preferred non-embedded symbols in our nuget package, and instead wanted us to publish symbol packages separately (snupkg files). Unfortunately, I don't have experience working with snupkg files, but I suspect the DebugType value for this is Portable, based on the metadata I see in previous versions of these packages.

I don't think we need to block on this, but it might be worth taking a look to see whether this might impact the release process, if for example it expects to find snupkg files but none are generated (because we use embedded symbols).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a test on 1ES and seems portable works as well to get the expected checkmarks. I'll set it to portable based on this recollection

@davidmrdavid davidmrdavid changed the title Add DebugType as embedded, to generate deterministic nupkgs in 1ES Add DebugType as portable, to generate deterministic nupkgs in 1ES Sep 18, 2024
@davidmrdavid davidmrdavid merged commit 7c8a5c0 into main Sep 18, 2024
4 checks passed
@davidmrdavid davidmrdavid deleted the dajusto/add-debugType-for-determinstic-builds branch September 18, 2024 18:25
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