You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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?
Reacted by Patrick Westerhoff, Kuinox and Omair Majid
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.
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.
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...
Reacted by Pavel Šustek, Michal Vrana, Kuinox, Dai, gbtb and Omair Majid
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.
Reacted by Patrick Stevens, Omair Majid, jhudsoncedaron and Frulfump
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?
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
I am on vacation and have intermittent access to email.
1) PreserveNewest here is a ticking timebomb. Needs something here that
knows about file versions
2) This isn't the first repackage native dll nuget package thing. Clearly
we need some form of "preserve timestamp of this file when packaging"
3) I recommend the smallest fix. "If the project file or nuspec file
provides a timestamp, deterministic pack is on by default, otherwise it is
off by default."
Activity
nkolev92 commentedon Sep 18, 2019
Important scenario in #8603, hit because of #7001.
tl;dr; 1980-1-1 might not be the best standard date because of timezones.
[-]Long term plan for deterministic pack[/-][+]Revisit deterministic pack[/+]poke commentedon Sep 22, 2019
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:
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.
olivier-spinelli commentedon Oct 3, 2019
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?
tmat commentedon Oct 3, 2019
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.
nkolev92 commentedon Oct 3, 2019
@olivier-spinelli Using UTC now would break determinism.
I agree.
The problem is not every package does that. Even then, depending on the timestamp is a bad idea.
tmat commentedon Oct 3, 2019
Agreed. Just saying we already have a mechanism that associates package with the source snapshot.
olivier-spinelli commentedon Oct 4, 2019
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...
92 remaining items
Re-enable support for deterministic pack
Re-enable support for deterministic pack
Re-enable support for deterministic pack
zivkan commentedon May 13, 2026
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.
omajid commentedon Jun 5, 2026
Documentation PRs (work in progress):
Add deterministic dotnet pack info (#54196)
RomiTshiornyMS commentedon Aug 17, 2026
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
joshudson commentedon Aug 18, 2026