I just wondered if it possible within various Visual Studio versions to automatically remove all references from a project that were never been used?
In your answer, please specify which version of VS the solution applies to.
To remove dependencies from projectsIn Solution Explorer, select a project. On the Project menu, choose Project Dependencies. The Project Dependencies dialog box opens. On the Dependencies tab, select a project from the Project drop-down menu.
In the first preview build of Visual Studio 2019 version 16.10, Microsoft adds a Remove Unused References command. It can be invoked by right-clicking on the project name or the dependencies node in Solution Explorer and select the " Remove Unused References... " command from the menu.
References are stored in the . csproj file.
If you have Resharper (plugin) installed, you can access a feature that allows you to analyze used references via Solution Explorer > (right click) References > Optimize References...
http://www.jetbrains.com/resharper/webhelp/Refactorings__Remove_Unused_References.html
This feature does not correctly handle:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With