Cornel
Cornel

Reputation: 4708

Remove unused references

I want to know if any tool exists for removing unused references (not unused using directives) within a .NET C# project.

Upvotes: 34

Views: 30518

Answers (6)

Yousha Aleayoub
Yousha Aleayoub

Reputation: 5715

ResolveUR - Resolve Unused Referencese Unused References

https://marketplace.visualstudio.com/items?itemName=battas.ResolveUR-ResolveUnusedReferences

Works with Visual Studio 2013, 2015, 2017 and 2019

Upvotes: 0

David Ferenczy Rogožan
David Ferenczy Rogožan

Reputation: 25471

JetBrains Resharper adds a menu item Remove Unused References to the References node's context menu in the Solution Explorer.

When you click it, it'll scan you project and list references which can be removed. You can further select which ones you want to remove.

Upvotes: 2

Laguna
Laguna

Reputation: 3876

Check out the Productivity Power-tool Plugin

Removing unused references from project is one of the many helpful features it has. It is free and it has some of the R# features.

Upvotes: 0

Carra
Carra

Reputation: 17964

Resharper has that option.

Upvotes: 0

Sam Harwell
Sam Harwell

Reputation: 100029

I am unaware of such a tool off the top of my head - I do know that Visual Studio does not include one by default. However, referenced assemblies that are not actually used by code in the project are automatically removed by the C# compiler from the list of assemblies referenced by the compiled program. If you use Reflector, you can compare the list of actual references to the list of references in the project, and remove the unnecessary ones that the project includes based on that.

Upvotes: 17

Cédric Rup
Cédric Rup

Reputation: 15958

Resharper will certainly do the trick...

Upvotes: 9

Related Questions