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
{{ message }}
Repository navigation
dotnet pack creates odd dates in package using version 3.0.100-preview9-014004 #3388
dotnet pack creates odd dates in package using version 3.0.100-preview9-014004
After switching to the version listed above our nuget packages started having very strange dates. The first date that is being displayed is inside of the nuget packages before being unpacked. The date is 12/29/1899.
Once we unpack the package, the date changes to 12/29/1979.
This only started occuring after we upgrade from 3.0.100-preview7-012821 to 3.0.100-preview9-014004.
So it is set to true by default? That is a huge change IMO to make it default to true. Since it defaults to an older date we have packages that are not getting updated on deployment of our web app because of how deployment tools like web deploy uses the dates.
I echo Jamie's sentiments. The change is sensible, but breaking, and I'm not sure customers have been made fully aware of how this changes deployments in Azure. I did find that prop, and did notice that it was set to true by default, which is why I commented on it. Windows and many other deployment systems use modified time as a way to know what should be overwritten. If you don't know what's newer (if it's an alpha or beta binary and you're using semantic versioning, then then major.minor.build may not increase).
Since it defaults to an older date we have packages that are not getting updated on deployment of our web app because of how deployment tools like web deploy uses the dates.
What are repro steps that show that this is a significant problem?
@phillipsj where does it go after that? I can see how this will effect deployments where assets are moved through a pipeline as a NuGet package, and then expanded out in another step and treated as loose files again, because their dates will now be fixed.
My assumption was that having different timestamps in the zip would affect the zip bytes (since the timestamps are encoded in the bytes that the zip represents), so that if you were to keep the timestamps, then the same build/pack scenario would lead to a different byte stream representation, thereby making it non-deterministic. I assumed that's why the change was made in the first place.
My suggestion was no timestamps in the zip :)
Then at extract time, the timestamps will be set to now.
My assumption was that having different timestamps in the zip would affect the zip bytes (since the timestamps are encoded in the bytes that the zip represents), so that if you were to keep the timestamps, then the same build/pack scenario would lead to a different byte stream representation, thereby making it non-deterministic. I assumed that's why the change was made in the first place.
I was suggestion, no timestamps in the zip :)
Then at extract time, the timestamps will be set to now.
OK that makes more sense, but I feel that leads to ancillary issues, namely that you cannot know when anything in a nuget file was built. Maybe the argument is that you shouldn't, but all tooling up to this point has worked under the assumption that when those files come out, the date is useful. If you were to set the date on unpack, for one you'll have to push those files on every deploy, since the timestamp will always be new. Worse, if you put in a replacement file on the server that's newer manually, then redeploy (i'm not suggesting this is a good idea), then it would always overwrite it. It violates common publishing semantics.
My thoughts are when the package is produced I should control the timestamp used. Then it will be set at build time to a value that I determine. All content inside of the package should have that timestamp. It would be deterministic in the sense that if I linked the timestamp to a SHA that I used to build the package, then every time I build that SHA and use that timestamp the results will be identical. An arbitrary date isn't needed and it should reflect when it was unpacked, but when it was created. Yeah that could change, but then you end up with different hashes invalidating the build. Deterministic and reproducible build documentation typically outlines that timestamps should be derived, but should be recorded/preserved at the time of the build. By making it settable, people who opt-in will determine how to record/preserve that timestamp and set it every time they create a build and package from the exact same source code.
[Reproducible-build.org](https://reproducible-builds.org/docs/deterministic-build-systems/) provides a nice simple take on the idea. We need known inputs and not depend on the build environment. Make it determinism opt-in and require a timestamp solves the issue, IMO.
@phillipsj Making the timestamp settable just shifts the problem elsewhere but it does not address the problem.
I think what NuGet pack could do is to calculate the timestamp based on the NuGet package version. That would make it monotonically increasing for release packages. Pre-release packages that do not differ in the 3-part number would still get the same timestamp. Would that be ok?
In any case I think the deployment systems still need to be updated to stop relying on timestamps.
I am very unfamiliar with these deployment technologies, but naively, I don't actually understand why you would ever want to deploy based on newer timestamp or newer versions. If I downgrade a package reference due to a bug that broke my app, shouldn't it deploy the older binaries from my newer source?
Reacted by Nikolche Kolev, Tomáš Matoušek, Olivier Spinelli, Michal Vrana, Patrick Stevens and Noah Sherwin
I think a potential mitigating factor is that the deployment technologies can be diverse. We are using webdeploy in some places, but In others we favored Run From Package, primarily to avoid locking, but the atomicity perks were also helpful. I’m wondering if this is even an issue for that given its behavior.
For thick client apps most people use MSI, and things certainly get worse there. Major/Minor/Revision are the only things that are counted as I recall with a tiebreaker on modified time. This certainly throws some of that out of whack.
If anyone who was affected in 2019 by this change is still watching this issue, there's renewed interest in bringing it back. A few weeks or months ago I tried to reproduce the problem this issue discusses, but I was unable to find a scenario where msdeploy to azure would fail to deploy dlls with the same or older timstamps.
Anyway, I'd appriciate your input, because so far this other thread only has commenters saying that determinisitic pack should be re-enabled: NuGet/Home#8601 (comment)
Activity
Macromullet commentedon Sep 17, 2019
I have confirmed this issue persists in RC1
livarcocc commentedon Sep 17, 2019
@rrelyea
Macromullet commentedon Sep 17, 2019
This seems to be related to deterministic packages introduced in preview 9:
https://docs.microsoft.com/en-us/nuget/release-notes/nuget-5.3
NuGet/Home#6229
Commit:
NuGet/NuGet.Client@4590967
Macromullet commentedon Sep 17, 2019
Just confirmed using
dotnet pack -p:Deterministic=false
serves as a workaround, but it's odd that the default is to enable deterministic builds.
DamianEdwards commentedon Sep 17, 2019
I reproduced the behavior locally on one of my existing projects too.
nkolev92 commentedon Sep 17, 2019
The deterministic property is set in the project itself.
The compiler respects the
<Deterministic>true</Deterministic>property, and starting with 3.0 so does NuGet at pack time.https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#deterministic
1980 was chosen as the min zip supported date.
The reason behind that if the customer wants deterministic binaries at build time, having deterministic packages is important too.
As @Macromullet linked NuGet/Home#6229 contains the reasoning.
Spec at https://github.com/NuGet/Client.Engineering/blob/master/Specs/Deterministic-Pack.md
phillipsj commentedon Sep 17, 2019
@nkolev92 we don't have that property set at all in our project. Why would it default to being enabled?
nkolev92 commentedon Sep 17, 2019
It's set by default in the SDK.
https://github.com/dotnet/sdk/blame/release/3.0.1xx/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props#L34
phillipsj commentedon Sep 17, 2019
So it is set to true by default? That is a huge change IMO to make it default to true. Since it defaults to an older date we have packages that are not getting updated on deployment of our web app because of how deployment tools like web deploy uses the dates.
nkolev92 commentedon Sep 17, 2019
@phillipsj
How are you deploying? What's the tooling used for deployment purposes?
//cc @tmat
Macromullet commentedon Sep 17, 2019
I echo Jamie's sentiments. The change is sensible, but breaking, and I'm not sure customers have been made fully aware of how this changes deployments in Azure. I did find that prop, and did notice that it was set to true by default, which is why I commented on it. Windows and many other deployment systems use modified time as a way to know what should be overwritten. If you don't know what's newer (if it's an alpha or beta binary and you're using semantic versioning, then then major.minor.build may not increase).
phillipsj commentedon Sep 17, 2019
@nkolev92 we are packing with Azure DevOps using the SDK.
rrelyea commentedon Sep 17, 2019
@Macromullet @phillipsj - @nkolev92 is asking about the "tooling used for deployment purposes" so we can understand more details when @phillipsj said:
What are repro steps that show that this is a significant problem?
DamianEdwards commentedon Sep 17, 2019
@phillipsj where does it go after that? I can see how this will effect deployments where assets are moved through a pipeline as a NuGet package, and then expanded out in another step and treated as loose files again, because their dates will now be fixed.
DamianEdwards commentedon Sep 17, 2019
Hypothetical example of a build pipeline that will be broken by this:
In this situation, you'll never get the new copies of the files as they went through a format that doesn't ever update the timestamps of the contents.
18 remaining items
nkolev92 commentedon Sep 18, 2019
@Macromullet
My suggestion was no timestamps in the zip :)
Then at extract time, the timestamps will be set to now.
Macromullet commentedon Sep 18, 2019
OK that makes more sense, but I feel that leads to ancillary issues, namely that you cannot know when anything in a nuget file was built. Maybe the argument is that you shouldn't, but all tooling up to this point has worked under the assumption that when those files come out, the date is useful. If you were to set the date on unpack, for one you'll have to push those files on every deploy, since the timestamp will always be new. Worse, if you put in a replacement file on the server that's newer manually, then redeploy (i'm not suggesting this is a good idea), then it would always overwrite it. It violates common publishing semantics.
nkolev92 commentedon Sep 18, 2019
Which at its core is counter to determinism.
We'll definitely factor in that input into our future work for pack determinism.
phillipsj commentedon Sep 18, 2019
phillipsj commentedon Sep 18, 2019
BTW, I would like it if we can ignore timestamps, unfortunately, legacy is catching us on this.
tmat commentedon Sep 18, 2019
@phillipsj Making the timestamp settable just shifts the problem elsewhere but it does not address the problem.
I think what NuGet pack could do is to calculate the timestamp based on the NuGet package version. That would make it monotonically increasing for release packages. Pre-release packages that do not differ in the 3-part number would still get the same timestamp. Would that be ok?
In any case I think the deployment systems still need to be updated to stop relying on timestamps.
phillipsj commentedon Sep 18, 2019
@tmat That is a reasonable solution too.
nguerrera commentedon Sep 18, 2019
I am very unfamiliar with these deployment technologies, but naively, I don't actually understand why you would ever want to deploy based on newer timestamp or newer versions. If I downgrade a package reference due to a bug that broke my app, shouldn't it deploy the older binaries from my newer source?
Macromullet commentedon Sep 18, 2019
I think a potential mitigating factor is that the deployment technologies can be diverse. We are using webdeploy in some places, but In others we favored Run From Package, primarily to avoid locking, but the atomicity perks were also helpful. I’m wondering if this is even an issue for that given its behavior.
For thick client apps most people use MSI, and things certainly get worse there. Major/Minor/Revision are the only things that are counted as I recall with a tiebreaker on modified time. This certainly throws some of that out of whack.
nkolev92 commentedon Sep 19, 2019
We have disabled the deterministic pack feature in the GA .NET Core version.
NuGet/Home#8601 is the issue to follow for further pack + determinism updates.
edit
I guess this issue can be closed now?
Update sourcelink, copyright, and package builds.
scalablecory commentedon Sep 23, 2019
Closing issue, it appears it was resolved in Nuget.
Increment 0.0.1 to fix date issue dotnet/core#3388
zivkan commentedon Dec 3, 2025
If anyone who was affected in 2019 by this change is still watching this issue, there's renewed interest in bringing it back. A few weeks or months ago I tried to reproduce the problem this issue discusses, but I was unable to find a scenario where msdeploy to azure would fail to deploy dlls with the same or older timstamps.
Anyway, I'd appriciate your input, because so far this other thread only has commenters saying that determinisitic pack should be re-enabled: NuGet/Home#8601 (comment)