Visual Studio 社区版 2015 和 2017 中缺少 CodeLens 引用计数

Missing CodeLens references count in Visual Studio Community edition 2015 and 2017

  1. Visual Studio 社区版中缺少引用计数 (代码镜头) 是否有原因?
  2. 是否可以在选项中启用它?

这是 Visual Studio 2015 和 2017 社区版的屏幕截图:

这是 Visual Studio 2013 年的屏幕截图:

来源:dailydotnettips.com

这不是通用的引用计数功能,它只是 CodeLens 的功能之一。 CodeLens 仅在 Visual Studio 2015 Pro and above 中可用。在 Visual Studio 2013 年,它是 Ultimate 独有的功能。

更新

正如其他人所指出的,安装 SSDT 或 SSMS 2016 也可能启用 CodeLens。那是因为 VS 2015 社区 Pro,具有不同的许可证和一些缺少的扩展,如 CodeLens。只要安装了扩展程序的二进制文件和设置,社区就会激活该扩展程序。

2019 年更新

"CodeLens has been a feature found only in Visual Studio Enterprise, but that will change in an upcoming preview of Visual Studio 2019, when it will also be available for the Community edition, likely in 2019" What's New in Visual Studio 2019

我在装有 VS 2015 社区版(更新 1)的 2 台机器上安装了 Visual Studio 2015 年的最新 SSDT 预览版 link,CodeLens 开始为我的所有项目工作。

https://msdn.microsoft.com/en-us/library/mt204009.aspx

我有 Visual Studio 2015 社区版,它最初没有 CodeLens。

但是,在转到工具 -> 扩展和更新 -> 产品更新,然后下载 SSDT 并安装 SSDT 包中的所有选项后,我的 VS 2015 社区版现在奇迹般地可以访问 CodeLens。

此功能已在 Visual Studio Community 2017 中禁用,尽管它听起来像是在预发布版本中暂时可用。

Visual Studio 团队 issued this statement 2017 年 3 月 14 日:

An authoring error in the SQL Server Data Tools resulted in the capability temporarily showing up incorrectly in Visual Studio Community when installed; the change you see is a result of correcting that mistake.

此外,在 Compare Visual Studio 2017 Offerings 页面上,CodeLens 似乎在社区版中不可用。

我不允许对上面的 R. Richards 回答发表评论,因此将其作为单独的回答发布:当我将 VS Pro 升级到 2017 时,CodeLens 引用对我来说也消失了。但只在我的桌面上 ("same" 升级在我的笔记本电脑上表现不同,其中 CodeLens 设置显然不受影响)。无论如何,只需在文本编辑器下启用 CodeLens 即可轻松解决:所有语言

另一种方法是右键单击成员,然后 select 'Find All References' 或热键 shift + F12*。您不仅会发现按项目分组的引用计数,还会发现底层代码行及其 类.

* 根据 Visual Studio 2017 社区。

在“工具”选项卡上选择“选项”。

在打开的window中选择如下所示,然后按确定。

祝你好运!!!