如何在解决方案中找到未使用的 NuGet 包? [英] How can you find unused NuGet packages in solution?

查看:46
本文介绍了如何在解决方案中找到未使用的 NuGet 包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在解决方案中找到未使用的 NuGet 包?

How can you find the unused NuGet packages in a solution?

我有很多解决方案,其中安装了很多软件包,其中很多都被标记为有更新.

I've got a number of solutions where there are a lot of installed packages, and a large number of them are flagged as having updates.

但是,我担心可能会有重大更改,所以我首先想通过删除所有未使用的包来进行清理.

However, I'm concerned there may be breaking changes, so I first want to clean up by removing any unused packages.

推荐答案

ReSharper 2016.1 有 删除未使用的 NuGet 的功能.

ReSharper 2016.1 has a feature to remove unused NuGet.

它可以在解决方案和解决方案中的每个项目上运行,并执行以下操作:

It can be run on a solution and on each project in a solution and it does the following things:

  1. 分析您的代码并收集对程序集的引用.
  2. 根据程序集的使用情况构建 NuGet 使用情况图.
  3. 没有内容文件、未使用本身和没有使用依赖项的包被假定为未使用并建议删除.

不幸的是,这不适用于 project.json 项目 (RSRP-454515a>) 和 ASP.NET 核心项目 (RSRP-459076)

Unfortunately, this doesn't work for project.json projects (RSRP-454515) and ASP.NET core projects (RSRP-459076)

这篇关于如何在解决方案中找到未使用的 NuGet 包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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