-
Notifications
You must be signed in to change notification settings - Fork 258
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
NoCache option does not work for packages.config based restore/install (GlobalPackagesFolder) #1406
Comments
Global packages folder and the cache folders are two different things.
We should revisit this inconsistent state of things and fix it. My current thoughts are to
|
"expand the packages to the global path and use that as a cache." Maybe I'm still misunderstanding something - this is the behavior I see. Packages are downloaded to the global path, unpacked there, then copied to [PackagesDirectory]. Restoring the package again into a new directory doesn't re-download the file, it pulls it from the global packages directory. To prove this point - if you add a file into an expanded package in the global packages folder, that file gets copied over if you do a restore into a new PackagesDirectory. See https://github.com/NuGet/NuGet3/blob/dev/src/NuGet.Protocol.Core.v3/DownloadResourceV3.cs and https://github.com/NuGet/NuGet3/blob/dev/src/NuGet.Protocol.Core.v3/Utility/GlobalPackagesFolderUtility.cs, and https://github.com/NuGet/NuGet3/blob/dev/src/NuGet.Packaging/PackageFolderReader.cs which is used to copy over the expanded package. Can you please explain what you mean by "this is where packages are expanded to, so they get consumed by the projects"? |
The -NoCache option is a misnomer, it means always download the packages (but they will still make it into the cache). Looking at our current backlog, this seems relatively low priority. |
For clarity, are you tracking this workitem to mean -NoCache should download the package each time, but it will not impact expansion into the GlobalPackagesDirectory (profile.nuget) -- that will continue to happen even with -NoCache? Trying to decide if I need to open another workitem to avoid always expanding into GlobalPackagesDirectory or if it is addressed here. |
We should probably cover it here in one go - Updated the top comment
|
@emgarten please orchestrate a design review for this ask, so we can end up with a clear behavior document, and tests etc. |
@yishaigalatzer Is the cli the only client which can use the GlobalPackages directory as a Also, if it is not a cache, the console messages need to be updated, as the term cache is used.
|
Everything can use it as a source. But it is indeed not a cache and we should fix the message. Thanks for pointing it out |
On machines with small c: drives, the global-packages folder can become an issue. We are currently seeing build machines with small c: drives and large d: drives running out of space over the course of a month. |
@pspill you can configure the global packages folder using NUGET_PACKAGES environment variable. We also support the nuget locals -clear command to automatically do periodic maintenance |
TODO:
We should probably cover it here in one go - Updated the top comment
The NoCache option doesn't work with packages.config based restore or install. The packages are still downloaded to the global package folder, and then copied to the PackagesDirectory.
Also, is %localappdata%\NuGet\Cache used anymore? GetPackageSources still adds it as a source if NoCache isn't specified, but I don't see where anything is ever written to it.
Perhaps this is a gap in my understanding... are %localappdata%\NuGet\Cache ("MachineCache") and %userprofile%.nuget\packages ("GlobalPackagesFolder") meant to do different things? I don't understand why they both exist.
The text was updated successfully, but these errors were encountered: