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

Visual StudioVisual Studio-2015Visual Studio-2017Codelens

Visual Studio Problem Overview


  1. Is there a reason why the references count (code lens) is missing in Visual Studio Community edition?
  2. Is is possible to enable it in the options?

Here is a screenshot of Visual Studio 2015 and 2017 Community edition:

methods without code lens

Here is a screenshot of Visual Studio 2013:

methods with code lens

source: dailydotnettips.com

Visual Studio Solutions


Solution 1 - Visual Studio

I installed the latest SSDT preview for Visual Studio 2015 from the link below on 2 machines I have with VS 2015 Community edition (Update 1), and CodeLens started working for all my projects.

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

enter image description here

Solution 2 - Visual Studio

This isn't a generic reference counting feature, it's just one of the features of CodeLens. CodeLens is only available in Visual Studio 2015 Pro and above. In Visual Studio 2013 it was a Ultimate-only feature.

UPDATE

As others have noted, installing SSDT or SSMS 2016 may enable CodeLens as well. That's because VS 2015 Community is Pro, with a different license and some missing extensions like CodeLens. As long as an extension's binaries and settings are installed, Community will activate the extension.

UPDATE 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

Solution 3 - Visual Studio

I have Visual Studio 2015 Community edition and it originally did NOT have CodeLens.

However, after going to Tools -> Extensions and Updates -> Product Updates and then downloading SSDT and installing all options within the SSDT package, my VS 2015 Community Edition now miraculously has access to CodeLens.

Solution 4 - Visual Studio

On the Tools tab choose Options.

In the open window choose like bellow, and then press ok. Example

Good Luck!!!

Solution 5 - Visual Studio

This feature has been disabled in Visual Studio Community 2017, although it sounds like it was temporarily available in pre-release versions.

The Visual Studio Team issued this statement on the 14th of March 2017:

> 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.

Also, on the Compare Visual Studio 2017 Offerings page CodeLens appears to not be available in the Community edition.

Solution 6 - Visual Studio

I'm not allowed to Comment on R. Richards answer above, so posting this as a separate answer: CodeLens references disappeared for me too when I upgraded my VS Pro to 2017. But only on my Desktop ("same" upgrade behaved differently on my laptop, where CodeLens settings apparently unaffected). Anyway, very easy to resolve just Enable CodeLens under Text Editor : All Languages

Solution 7 - Visual Studio

An alternative is to just right-click the member and select 'Find All References' or the hot key shift + F12*. Not only you will find the count of references grouped by project, but also the underlying code lines and their classes.

* As per Visual Studio 2017 Community.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionH. PauwelynView Question on Stackoverflow
Solution 1 - Visual StudioR. RichardsView Answer on Stackoverflow
Solution 2 - Visual StudioPanagiotis KanavosView Answer on Stackoverflow
Solution 3 - Visual StudioJimmy ShawView Answer on Stackoverflow
Solution 4 - Visual Studiouser11116003View Answer on Stackoverflow
Solution 5 - Visual StudiopiusView Answer on Stackoverflow
Solution 6 - Visual StudioPeterView Answer on Stackoverflow
Solution 7 - Visual StudioMHDukeView Answer on Stackoverflow