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

NuGet Package Manager extracts files with incorrect timestamp #11039

Closed
vsfeedback opened this issue Jul 18, 2021 · 6 comments
Closed

NuGet Package Manager extracts files with incorrect timestamp #11039

vsfeedback opened this issue Jul 18, 2021 · 6 comments
Assignees
Labels
Transferred issue This issue is transferred from VSFeedback or other github repo Type:Bug

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[regression] [worked-in:I'm not sure, maybe 16.7.x]
When using the built in NuGet Package Manager in Visual Studio 2019 (16.10.3) to install, update or restore packages the downloaded files seem to have an incorrect timestamp. They are two hours later than they should be.
When I run nuget from the command line to install a package the files have the correct timestamp but using the NuGet Package Manager they seem to get changed.

Things I have tried:

  • Clearing the NuGet cache
  • Manually deleting all files from the local and global cache folders
  • Install-Package [Package-Name] -Reinstall
  • Deleting the package and using the Restore NuGet Packages feature
  • Uninstalling the NuGet Package Manager and reinstalling it through the Visual Studio Installer
  • Testing with the Visual Studio 2022 Preview

Things I have noticed:

  • The .nupkg file downloaded throught the NuGet Package Manager has the correct timestamp but the extracted files have not So it might be related to the way the NuGet Package Manager extracts the files or some post-process
  • Running nuget install [Package-Name] separately works just fine
  • The time offset is alway two hours which might be related to my CET timezone with DST
  • The issue started after I updated from an older version of Visual Studio 2019
  • It works correctly on two other machines with the same software versions and timezone settings

I have NuGet Version: 4.3.0.4406


Original Comments

Feedback Bot on 7/9/2021, 01:40 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

@ghost ghost added the Transferred issue This issue is transferred from VSFeedback or other github repo label Jul 18, 2021
@heng-liu
Copy link
Contributor

heng-liu commented Jul 18, 2021

I could repro by installing newtonsoft.json in different ways:
1.Clear the global package folder and install newtonsoft.json by running Install-Package newtonsoft.json in Package manager console.
The timestamps are:
2

2.Clear the global package folder and install newtonsoft.json by runningnuget.exe install newtonsoft.json
The timestamps are:
1

There should be no discrepancies for timestamps of .signature.p7s, .nuspec files when using different tools.

@heng-liu
Copy link
Contributor

Found this comment: #7395 (comment)

@zkat
Copy link
Contributor

zkat commented Jul 19, 2021

@erdembayar please validate this and move it back to new issues as needed (add the NeedsTriageDiscussion label, too)

@erdembayar
Copy link
Contributor

erdembayar commented Jul 26, 2021

I could repro by installing newtonsoft.json in different ways:
1.Clear the global package folder and install newtonsoft.json by running Install-Package newtonsoft.json in Package manager console.
The timestamps are:
2

2.Clear the global package folder and install newtonsoft.json by runningnuget.exe install newtonsoft.json
The timestamps are:
1

There should be no discrepancies for timestamps of .signature.p7s, .nuspec files when using different tools.

It looks it's not a bug, it's happening because of we made changes with NuGet/NuGet.Client#3793
Because of far away versions of VS and NuGet.exe they exhibit are quite different behavior. Because latest VS 16.10.3 has fix for correct local timestamp instead of UTC timestamp. You can read more from #7395

But NuGet 4.3.0.4406 is very old version which doesn't have fix so it always show a timestamp which is not corrected to your local.

Here is screenshot from NuGet 4.3.1 old, it's UTC:
image

Here is screenshot from NuGet 5.10 new and it's local timestamp:
image

@erdembayar
Copy link
Contributor

So please update to latest NuGet 5.10 to avoid discrepancy between VS and NuGet.
It looks current behavior is favored due to msbuild use lastwrite timestamp to detect if file is modified then decide if overwrite is necessary.

@erdembayar
Copy link
Contributor

Thank you reporting this issue. At this moment this looks not a actual bug so I'm closing it.
Please feel free to comment or open a new issue if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Transferred issue This issue is transferred from VSFeedback or other github repo Type:Bug
Projects
None yet
Development

No branches or pull requests

4 participants