Remove Unused References
Applies to: Visual Studio
Visual Studio for Mac
Visual Studio Code
This refactoring applies to:
- C#
- Visual Basic
What: Lets you remove unused references for SDK style projects.
When: You want to clean up project references and NuGet packages that have no usage.
Why: Removing project references that have no usage can help save space and reduce startup time of your application, because it takes time to load each module and avoids having the compiler load metadata that will never be used.
How-to
Right click on a project name or dependencies node in Solution Explorer.
Select Remove Unused References.
The Remove Unused References dialog will open displaying references that have no usage in source code. Unused references will be pre-selected for removal with an option to preserve references by selecting
Keep
from the Action drop down.Click
Apply
to remove selected references.
See also
Feedback
Submit and view feedback for