Skip to content

Removing unused Nuget Packages

After working with Visual Studio and R# for many years now I discovered this feature just yesterday. Maybe some of you find it useful too.

I removed code that was depending on an external Nuget Package. Because the code is gone my project didn’t need the Nuget Package anymore. How to fast and safely remove the references and the package?

Let’s check the currently installed packages first:


Instead of opening the Nuget Packagemanager and uninstalling things manually there is faster way: right click on the project in the Solution Explorer and go into R# Refactor menu. There you’ll find the Remove unused references menu item.


This command will show you a dialog where one not only can select the plain assembly references to remove but also the references that come from a installed Nuget Package. This dialog shows a different icon for package references. See the highlighted item.


Clicking next will remove the selected references. For references that where introduced by an installed package the package is uninstalled too. Means your package folder is cleaned and the package is also removed from the package.config / .csproj.

The following show that not only the reference but also the package was removed:


Its a nice timesaver!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s