DEV Community

Kenichiro Nakamura
Kenichiro Nakamura

Posted on

NuGet Developer Tips: Refer local nupkg and delete cache

When we develop NuGet package in local environment, there are several things we need to be careful.

NuGet package source

In Visual Studio or NuGet cli, we can specify source where to find the package. When developing NuGet package, we can use local folder path as NuGet source.

nuget source

By doing this, we can omit uploading package to feed or NuGet.org for test.

NuGet package version

Whenever we update something, we need to give different version for nupkg file, so that NuGet manager can download new package. If we use same version number, then NuGet manager keep using local cache which downloaded previously.

Delete local NuGet pack

We sometimes need to delete local NuGet pack to avoid conflict between local cache versus package in feed. We can find the cache path by running NuGet command.

nuget locals all -list
Enter fullscreen mode Exit fullscreen mode

For Windows, I find it in my profile.

%UserProfile%\.nuget\packages

nuget cache

Just delete the specific package folder. Even though we can use NuGet cli to delete cache for source level, I won't recommend clear entire cache as we have to download all dependencies again when we restore or compile next time. Please teach me if NuGet cli has command to delete specific cache.

Top comments (0)