Removing all unused references from a project in Visual Studio projects

前端 未结 14 2082
北荒
北荒 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:16

    In a Visual Basic project there is support to remove "Unused References" (Project-->References-->Unused References). In C# there isn´t such a function.

    The only way to do it in a C# project (without other tools) is to remove possible unused assemblies, compile the project and verify if any errors occur during compilation. If none errors occur you have removed a unused assembly. (See my post)

    If you want to know which project (assembly) depends on other assemblies you can use NDepend.

提交回复
热议问题