Skip to content

Revisit deterministic pack #8601

Closed
NuGet/NuGet.Client
#7020

Description

@nkolev92

The pack implementation for deterministic was reverted in 5.3 due to #8599.

This issue tracks re-enabling that feature.

Important:

The implementation of this feature should account for #7001.
Consider the #8603 scenario.

Activity

  1. self-assigned this
    on Sep 17, 2019
  2. added this to the 5.4 milestone on Sep 17, 2019
  3. nkolev92 commented on Sep 18, 2019

    @nkolev92
    MemberAuthor

    Important scenario in #8603, hit because of #7001.

    tl;dr; 1980-1-1 might not be the best standard date because of timezones.

  4. changed the title [-]Long term plan for deterministic pack[/-] [+]Revisit deterministic pack[/+] on Sep 18, 2019
  5. poke commented on Sep 22, 2019

    @poke

    I personally think that having a real date is somewhat useful. Since NuGet probably won't be able to figure out a deterministic real date for a package, I think having a way to externally set the date would be useful.

    @tmat said in the dotnet issue the following:

    Making the timestamp settable just shifts the problem elsewhere but it does not address the problem.

    But I actually think that's exactly a valid way to solve this. NuGet does not have this information, nor has MSBuild. But there are systems that do have this kind of information: version control systems.

    When generating a deterministic build and pack output, I would expect that to always happen based on a specific version in the VCS. So when packing deterministically, we could pass the commit date from the source revision the build is based on. That way, there would be a fixed and deterministic date (1) that makes sense (because it's real), (2) and that's even able to identify the source a pack is based on.

    I could see that actually figuring out that date is not a responsibility for NuGet (since it would have to interact with the VCS then), so the default could be a different behavior. But then I would really like there to be some way to externally set the date during pack, so that e.g. a build process can pass the revision date to the pack step.

  6. olivier-spinelli commented on Oct 3, 2019

    @olivier-spinelli

    Yes, having a real date is somewhat useful, and yes the commit date is the best candidate (when a VCS is used), otherwise the date can be derived from... whatever you can imagine.

    Honnestly a simple PackageDate[Time]Utc or a more general BuildDate[Time]Utc property that could be initialized with UtcNow seems perfect to me...

    ...or did I miss something huge?

  7. tmat commented on Oct 3, 2019

    @tmat

    I don't see why is there a need for timestamps on the items zipped in the NuGet package. Why wouldn't the version stored in these files be sufficient/better.
    NuGet packages already have commit SHA metadata from VCS, so it is easy to find out what source snapshot were they built from.

  8. nkolev92 commented on Oct 3, 2019

    @nkolev92
    MemberAuthor

    @olivier-spinelli Using UTC now would break determinism.

    I don't see why is there a need for timestamps on the items zipped in the NuGet package. Why wouldn't the version stored in these files be sufficient/better.

    I agree.

    NuGet packages already have commit SHA metadata from VCS, so it is easy to find out what source snapshot were they built from.

    The problem is not every package does that. Even then, depending on the timestamp is a bad idea.

  9. tmat commented on Oct 3, 2019

    @tmat

    he problem is not every package does that. Even then, depending on the timestamp is a bad idea.

    Agreed. Just saying we already have a mechanism that associates package with the source snapshot.

  10. olivier-spinelli commented on Oct 4, 2019

    @olivier-spinelli

    You got me wrong: I absolutely don't care of all these date/time. My goal is only to achieve "Deterministic Packages".

    My "proposal" is only because there are dates at some places (and that purely removing them seems unrealistic).

    I'm just saying: let's define ONE MSBuild date property, let's it empty by default (following the MSBuild empty property pattern for (re)definition), at the very last moment, use the Conditional == '' to set the UtcNow time (and yes, in such default, unspecified, scenario, we have lost the "Deterministic Package")...

    But for ANY other scenario, we can set this MSBuild Date to be what "we" (we being the tool) want...

  11. 92 remaining items

  12. modified the milestones: Backlog, 7.9 on May 12, 2026
  13. zivkan commented on May 13, 2026

    @zivkan
    Member

    This will make it into .NET 10.0.400 SDK. NuGet's having a code flow issue into dotnet's Virtual Mono Repo, so it might take a few days before a daily build of the SDK has the change, but it will make it into 10.0.400.

  14. omajid commented on Jun 5, 2026

    @omajid
    Contributor
  15. modified the milestones: 7.9, 7.8 on Jul 2, 2026
  16. RomiTshiornyMS commented on Aug 17, 2026

    @RomiTshiornyMS

    Reading through this thread I understand the justifcation of having deterministic pack, but how come we're enabling it by default in newer versions of .NET SDK instead of having it be an opt-in?

    I've opened up an issue regarding a blocker some consumers of our library have ran into when they picked up new versions: Deterministic pack defaults rewrite package entry timestamps and change PreserveNewest behavior · Issue #15050 · NuGet/Home

    We didn't really have a choice in the .NET SDK as our pipelines automatically chose to start running 10.0.400. We didn't even notice until our consumers started reporting issues downstream

  17. joshudson commented on Aug 18, 2026

    @joshudson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions