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

Provide a disk clean-up option #8076

Closed
miloush opened this issue May 1, 2019 · 6 comments
Closed

Provide a disk clean-up option #8076

miloush opened this issue May 1, 2019 · 6 comments
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Feature

Comments

@miloush
Copy link

miloush commented May 1, 2019

The NuGet cache should be listed in the Disk Clean-up entries. I am reaching low disk space every now and then while NuGet cache is happily eating gigabytes of unneeded data.

As far as I can tell from Creating a Disk Cleanup Handler, a simple registry entry might do without any code required, e.g.:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\NuGet Cache Files]
@="{C0E13E61-0CC6-11d1-BBB6-0060978B2AE6}"
"Description"="Whenever you install, update, or restore a package, NuGet manages packages and package information in several folders outside of your project structure. Cleans the default global-packages, http-cache, temp, plugins-cache and package-cache locations."
"Display"="NuGet Cache"
"FileList"="*.*"
"Flags"=dword:00000059
"Folder"="%userprofile%\\.nuget\\packages|%localappdata%\\NuGet\\v3-cache|%localappdata%\\NuGet\\plugins-cache|%localappdata%\\NuGet\\Cache"

image

Alternatively (or in addition), the CleanupString can be used to invoke nuget locals all -clear to handle location overrides, provided the path to nuget is known.

@alejandro5042
Copy link

Additionally, we can add an date policy:

LastAccess: The number of days that must have elapsed since a file was last accessed or a directory was created for that file or directory to be considered for cleanup.

But not sure how that works when you've disabled NTFS Last Access Time...

@nkolev92
Copy link
Member

Dup of #4980

@nkolev92 nkolev92 added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Apr 23, 2020
@miloush
Copy link
Author

miloush commented Apr 23, 2020

The #4980 suggests an automatic cleaning policy. This issue suggests a way to explicitly clear the cache. Even more specifically, this issue suggests an entry in the disk clean-up options. How are the two issues duplicate?

@donnie-msft
Copy link
Contributor

Just wanted to follow-up with this. The proposal here is for a Windows feature, but NuGet already provides CLI tooling that will clear folders....

dotnet nuget locals <CACHE_LOCATION> [(-c|--clear)... is documented here:
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-locals#arguments

@miloush
Copy link
Author

miloush commented Jul 1, 2020

Thanks @donnie-msft, I pointed out the CLI tooling could be called using the CleanupString setting (and required to correctly handle location overrides), so the proposal can be treated as for integrating the existing tooling into the Windows disk clean-up feature.

@donnie-msft
Copy link
Contributor

Sorry, I actually missed your last sentence there, but I've added the docs link in case someone stumbles on this Issue.

I personally like your idea of having some OS-level integration; however, it's likely not something that will become part of NuGet,
especially since it's OS-specific. Users can wrap our tooling as your suggestion implies to regularly clear these caches.

We also have the previously mentioned backlog feature to prevent these folders from ballooning with no-longer-used packages in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Feature
Projects
None yet
Development

No branches or pull requests

6 participants