94
  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

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
  • 5
    I know it's been said codelens is not available to VS Community, but on my work machine it somehow showed up for me, and I also use VS Community on a home computer and it is lacking it, I don't know how I got it to show up at work. Anyone else seen codelens showing up on their VS Community? – Ray Jan 22 '16 at 23:09
  • @fanray: 1) Have you maby another version of VS with codelens installed on your pc? 2) A person I know has also VS Community with codelens. – H. Pauwelyn Jan 23 '16 at 10:17
  • yeah I actually have 2013 Pro installed on that machine, do you or anyone by chance know how to get codelens to show up without another installation besides VS Community? – Ray Feb 16 '16 at 17:50
  • 2
    double click a method and Ctrl K + R and you get a poormans version of that but i do miss it dearly as well! – Andy Sep 27 '16 at 20:36
  • That's so bad - even the free Visual Studio Code can show the references and is able to click on it :-( – GreenEyedAndy Aug 23 '17 at 14:54
  • Related / possibly more up to date post relating to Visual Studio 2017 here : https://stackoverflow.com/q/42583514/4975230 – jrh Sep 07 '17 at 14:53
  • I see the references count in VS 2015 community and I don't see it in VS 2017 community. – Angelo Mascaro Nov 08 '17 at 17:33

7 Answers7

126

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

R. Richards
  • 24,603
  • 10
  • 64
  • 64
  • 5
    Shazaam! This solution worked. I now have references above each function in vb.net in my VS 2015 Community. References are awesome because a single click takes you from a function to any other function that calls that function. Saves time. – Doug Null Mar 18 '16 at 12:57
  • 2
    I wanted to add that CodeLens is included in one of the extra SQL Server x Services bundled with the DB. Do not untick anyone to make sure you have what you want. I had to modify installation because I unticked them all the first time. – JohnTube Mar 30 '16 at 10:35
  • Yes it's work with update 2, you need to install all SQL Server x Services like JohnTube mentioned – tsohtan May 18 '16 at 04:06
  • VS Community *is* VS Pro. If an extension's settings and binaries are there, the extension will work. Codelens obviously isn't packaged with VS Community but it is packaged in SSDT, possibly to allow CodeLens to work with database projects – Panagiotis Kanavos Jun 22 '16 at 07:28
  • 5
    To be precise, you only need to install "SQL Server Integration Services". Along with the mandatory "SQL Server Database" http://i.imgur.com/XFWFf85.png. I think it's part of the "Microsoft Visual Studio Tools for Applications 2015 Language Support"-package, but I base that of a hunch. – mausworks Sep 10 '16 at 15:57
  • Doesn't seem to work with VS 2015 Community Update 3 on Windows 8.1. I've tried installing (one at a time) full old/preview SSDT, full latest SSDT, partial SSDT (SSIS only), SSMS, but nothing enables CodeLens anymore. Maybe these work-arounds have effect on Windows 10 only? – Nick Oct 29 '16 at 01:01
  • 1
    @Nick it doesn't seem to work anymore. But I have another laptop on Windows 10, VS2015 community and codelens. I'm guessing MS fixed this on newer VS 2015 community installs – MRainzo Nov 13 '16 at 20:33
  • 3
    After install SSDT as with your link (SQL Server Data Tools (17.0 RC1)) it continues to NOT APPEAR. Neither in code or Options >Text Editor > All Language =( I have the Update 3. – Gelásio Nov 23 '16 at 10:19
  • The screenshot was what I was looking for.. but only because I was too blind to see the search box in the Options screen =D – madannes Feb 20 '17 at 20:43
  • Does this still work in 2017? I see comments stating that this doesn't work as of Nov of 2016. Is that the case? – SolidSnake4444 Feb 24 '17 at 01:04
  • It works and the option can be found the same place for VS2017. I just did it. – radbyx Mar 08 '17 at 11:44
  • @YuvalLevy according to the comments above, yes. – R. Richards Mar 21 '17 at 13:42
  • The link isn't preview or RC version anymore and doesn't work for me. Mine is Windows 7 64bit and VS 2015 Community Update 3.. – Jenix May 28 '17 at 04:28
76

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

Urielzen
  • 476
  • 7
  • 17
Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
  • 4
    Another person have also the community version of VS but he has the reference count! – H. Pauwelyn Oct 15 '15 at 09:42
  • Are you sure about this? Did you ask them? Before downvoting, did you check Microsoft's official page? Perhaps that other person actually has Pro, or used a hack to install CodeLens on VS Community. Or perhaps it's a Preview version of the Pro edition, not Community – Panagiotis Kanavos Oct 15 '15 at 10:05
  • 1
    Yes 100% sure. I have also seen in your link and indeed you have right. but there is someone that has it with the community version. – H. Pauwelyn Oct 15 '15 at 10:09
  • More evidence https://msdn.microsoft.com/en-us/library/dn269218.aspx?f=255&MSPPError=-2147217396; https://superuser.com/questions/865715/visual-studio-2015-codelens-packages – qxg Oct 15 '15 at 10:20
  • @qxg Evidence of what? There's no doubt that CodeLens is *not* available in the Community Edition. In fact, the editions & licensing pages are more valid than the documentation pages - one can argue that a documentation page is slightly out of date. You can't do that with the product pages – Panagiotis Kanavos Oct 15 '15 at 10:22
  • @Panagiotis Kanavos, I didn't disagree with you. Just open that link. – qxg Oct 15 '15 at 10:24
  • I did. I'm just saying that MS can (and has in the past) claim that a documentation page is out of date. They can't do that with the editions page though - any discrepancy would be instant news. Although, this page shows that they tried to make it crystal clear that CodeLens is not in Community by putting a warning box at the top of the relevant pages – Panagiotis Kanavos Oct 15 '15 at 10:26
  • Panagiotis is right. Codelens is available only from Pro edition and above. – balajikris Oct 16 '15 at 17:43
  • 1
    I just listened to .Net Rocks episode "Building Visual Studio Code with Sean McBreen". In this episode Sean says that CodeLens is available in VS Code and in the Community edition of Visual Studio. Now I'm totally confused, – Bas Jansen Nov 11 '15 at 17:30
  • It's definitely available in VS Code. Now they open sourced VS Code surely it can find it's way into VS Community Edition? – Stewart_R Nov 20 '15 at 14:13
  • @Stewart_R where did you read that? Nothing like that was announced in Connect 2015. VS Code is a completely different application - in fact it's written in TypeScript. Whatever functionality is implemented there has nothing to do with CodeLens – Panagiotis Kanavos Nov 20 '15 at 14:51
  • @PanagiotisKanavos I didn't read it. I opened a C# file in VS Code and there it was... – Stewart_R Nov 20 '15 at 21:16
  • @Stewart_R are you mistaking CodeLens with Intellisense perhaps? – Panagiotis Kanavos Dec 02 '15 at 12:09
  • @PanagiotisKanavos Nope. Maybe give it a try for yourself, perhaps? – Stewart_R Dec 02 '15 at 16:31
  • @Stewart_R are you referring to [this](https://code.visualstudio.com/Docs/languages/csharp#_code-lens)? The marketing name may be the same but this is *not* the same feature (libraries, code, interfaces) as the one in Visual Studio. It works only for DNX projects and displays only reference info, when VS would display reference, source control, test results and any other information provided by additional CodeLens addins. – Panagiotis Kanavos Dec 03 '15 at 11:10
  • @PanagiotisKanavos Yes - I am referring to that. Its called CodeLens and looks exactly like the OP's screenshot, therefore CodeLens IS available in VS Code, right? Thanks for your insight into how CodeLens is implemented in a different way in VS Code with fewer features.. – Stewart_R Dec 03 '15 at 13:25
  • 2
    Strangely enough, it showed up in my "VS2015 Community" after I installed SQL Server Management Studio 2016. – Dan Ware Jun 21 '16 at 19:32
  • 3
    VS Community *is* VS Pro. If an extension's settings and binaries are there, the extension will work. Codelens obviously isn't packaged with VS Community but it is packaged in SSMS, possibly to allow CodeLens to work with database projects – Panagiotis Kanavos Jun 22 '16 at 07:28
  • 8
    I have installed SSDT and SSMS 2016 and CodeLens still won't show up in my VS community. Any other ways to get CodeLens in community? – justadeveloper Nov 12 '16 at 05:18
23

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.

Jimmy Shaw
  • 1,097
  • 1
  • 12
  • 19
16

On the Tools tab choose Options.

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

Good Luck!!!

10

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.

pius
  • 2,344
  • 1
  • 23
  • 25
1

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

Peter
  • 61
  • 8
1

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.

H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
mhDuke
  • 137
  • 1
  • 10