Cleaning Nuget Packages
I noticed that the disk space on my development computer had significantly decreased. After running
df -h . via the terminal, I found that there were a lot of files contained in a
nuget directory on the system. Upon further investigation, I found that those files were downloaded when you add a reference to a package in your .NET application.
The way things works, it stores a local copy of the package on your computer, so that it does not have to be downloaded each time you compile or create a release of your application.
The solution for me was to create the script below. As mentioned in the comments of the script, It is bets to run this once per month. Now if you are doing a lot of work with the same packages, then you may want to consider running the script or command less frequently than than what I do.
I have added the disk space
df command to the script so that I can see how much space was recovered from cleaning up the packages on the system.
#!/bin/bash ## Description: remove nuget packages from system ## suggested to run this once per month to clean disk clean date df -h . /usr/bin/dotnet nuget locals -c all df -h . date