Removing all unused references from a project in Visual Studio projects

前端 未结 14 2059
北荒
北荒 2020-11-29 16:41

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,

14条回答
  •  失恋的感觉
    2020-11-29 17:25

    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:

    • Dependency injected assemblies
    • Dynamically loaded assemblies (Assembly.LoadFile)
    • Native code assemblies loaded through interop
    • ActiveX controls (COM interop)
    • Other creative ways of loading assemblies

    enter image description here

提交回复
热议问题