从Visual Studio项目中的项目中删除所有未使用的引用 [英] Removing all unused references from a project in Visual Studio projects

查看:1246
本文介绍了从Visual Studio项目中的项目中删除所有未使用的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道是否可以在各种Visual Studio版本中自动删除项目中从未使用过的所有引用?

在回答中,请指定该解决方案适用于哪个版本的VS.

解决方案

如果安装了Resharper(插件),则可以访问一项功能,该功能允许您通过 Solution Explorer>(右键单击)引用来分析使用过的引用. >优化参考...

http://www.jetbrains.com/resharper/webhelp/Refactorings__Remove_Unused_References.html

此功能无法正确处理:

  • 依赖注入的程序集
  • 动态加载的程序集(Assembly.LoadFile)
  • 通过互操作加载的本机代码程序集
  • ActiveX控件(COM互操作)
  • 其他新颖的加载程序集方式

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.

解决方案

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

这篇关于从Visual Studio项目中的项目中删除所有未使用的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆