How can I display the references on top of a method declaration?
I looked for it in the Visual Studio properties, but could not find it.

- 101,809
- 122
- 424
- 632

- 2,377
- 2
- 9
- 5
-
Possible duplicate of [Missing CodeLens references count in VS Community edition](https://stackoverflow.com/questions/33144785/missing-codelens-references-count-in-vs-community-edition) – Andrew Cameron Jul 07 '17 at 17:20
-
Also the case for Visual Studio 2019 Preview. Manually turn on CodeLens – OzBob Feb 17 '20 at 08:43
8 Answers
In Visual Studio Professional or Enterprise you can enable CodeLens by doing this:
Tools → Options → Text Editor → All Languages → CodeLens
This is not available in some Community Edition versions
-
32@FADI1987 what instance of Visual Studio you use? CodeLens not available for Community Edition. – Sergey Vasiliev Mar 14 '17 at 21:49
-
5@FADI1987 this function (CodeLens) is not available for Community Edition. But I can't say anything about ReSharper (I don't know). – Sergey Vasiliev Mar 14 '17 at 21:53
-
I have Visual studio Enterprise with resharper. I can see code lens feature According to this [link](https://www.visualstudio.com/vs/compare/)- code lens is not availble on community edition. – ISHIDA Mar 14 '17 at 21:55
-
4
-
2yeah, that's not cool - in VS2015 community there is reference link available, but not in VS2017 community :( – Prokurors Jul 03 '17 at 21:19
-
JetBrain should add code reference into Resharper.I guess I'll keep vs2015 for a while. – Louis Nov 15 '17 at 20:50
-
1...and I thought Community Edition was supposed to be the full package – Arkiliknam Nov 27 '17 at 15:15
-
I have VS 2017 Pro (checked it in Help) and while Code Lens is on (some info including references appears above method declarations) the Code Lens option is still not in that menu. – MGOwen Mar 16 '18 at 01:05
-
1
-
My VS 2019 Enterprise bugged out but didn't close for some reason and all method references stopped working. I closed and re-opened another instance and everything got sorted out. – Kevy Granero Nov 16 '20 at 05:44
-
Maybe you have to wait a little time in order to get the references, while the VS read all the code. Tested in VS2019 Community Edition as well. – Leandro Bardelli Nov 11 '21 at 14:17
-
Codelens is also available in Visual Studio 2022 Community Edition. You can quickly go to the menu section where to toggle it, by pressing ctrl+q, then typing "codelens" and pressing Enter. – Protector one Feb 23 '23 at 13:07
-
How the heck did this option got turned off in my VS from one day to another? Probably due to an update. – Andreas Mar 08 '23 at 09:26
For display references on the top of method you have to enabled the CodeLens option in Visual Studio Professional and Visual Studio Enterprise.
Use below steps to enabled it.
1. Go to Tools and then select Options :
2. Then Select Text Editor -> All Languages -> CodeLens
3. Click on check box to Enable Code Lens:
Now you can see the references on the top of methods.
This will not work for VS - Community Edition.

- 2,248
- 2
- 15
- 23
-
mine is enabled but them other options are not even displayed. VS Community 2017 – Josue Martinez May 28 '19 at 18:04
-
For VS Community 2017 you need to install SSDT or SSMS 2016 it may enable CodeLens for you. If an extension's settings and binaries are there, the extension will work. Ref : https://developercommunity.visualstudio.com/content/problem/26176/codelens-vanished-between-vs14-15.html?childToView=29769#comment-29769 – Laxman Gite May 29 '19 at 09:55
-
3I have Microsoft Visual Studio Community 2019 in it's working fine. I was able to turn it on by following the steps of this answer. – Mauro Bilotti Feb 16 '21 at 20:29
-
1Confirming this solution works on Visual Studio 2019 Community Edition. – k_rollo Nov 30 '21 at 08:36
-
Is this feature can be enabled in .js file as well for JavaScript functions? It is tedious to find js function and variable reference in javascript also. – Shantilal Suthar Feb 07 '23 at 07:16
No luck with Code lens in Community editions.
Press Shift + F12 to find all references.

- 2,526
- 22
- 32
-
4
-
1I have the Visual Studio Community 2017 (v 15.9.9) and it already has the Code Lens feature on the path explained by @ISHIDA – Pimenta Apr 01 '19 at 16:34
-
1@Pimenta it is there, but when checking it, references are still not shown. I am on version 15.9.10 – Janis S. Apr 02 '19 at 16:05
CodeLens is not available in the Community editions. You need Professional or higher to switch it on.
In VS2015, one way to "get" CodeLens was to install the SQL Server Developer Tools (SSDT) but I believe this has been rectified in VS2017.
Still you can get all method reference by right clicking on the method and "Find All references"

- 1,181
- 12
- 18
-
I have Visual Studio 2019 Community Edition , and it has CodeLens at path Tools → Options → Text Editor → All Languages → CodeLens – Saleh Jun 20 '21 at 07:01
For anyone who looks at this today after 2 years, Visual Studio 2019 (Community edition as well) shows the references

- 543
- 1
- 6
- 16
-
3Thanks, but for some reason, Codelens was by default disabled in my version of VS. So I had to enable it, but finally - it works. – faint220 Jun 24 '19 at 20:56
-
Thanks, for some reason code lens was enabled for me, so I had to disable it as it was totaly useless and just disturbed me searching sth in code and during work. – Adam Staszak May 20 '20 at 08:52
-
I have needed this feature for long. All I did was to enable it on 2019. – Olorunfemi Davis Jul 29 '20 at 10:57
-
1Heres how to enable this in VS 2019 Community https://dev.to/programazing/codelens-in-visual-studio-community-edition-1n02 – pawciu May 24 '21 at 10:00
In previous posts I have read that this feature is available on VS 2015 community if you first install SQL Server express (free) and then install VS. I have tried it and it worked.
I just had to reinstall Windows and am going through the same procedure now and it did not work, so I will try again. I know it worked 6 months ago when I tried.
-
As of this morning the following VS and SQL server (including SSDT) works in combo to get you CodeLens. I am not sure where else I should have, but have provided the files on MediaShare. [SSMS-Setup-ENU-1653.exe](http://www.mediafire.com/file/q9k5it271dc6arh/SSMS-Setup-ENU-1653.exe) and [vs_community_ENU.exe](http://www.mediafire.com/file/jhpl5yndubb1lpw/vs_community_ENU.exe). I hope this helps anyone still looking. – petrosmm Sep 22 '17 at 17:35
-
1Hope this works - its a deal breaker between me continuing to develop in VS2017 community and going back to VS2015 community. The issue is I already upgraded my project to 2017 from 2015 and had issues trying to just open the project again in VS2015. Will try this combination with the files @MaximusPeters provided and let you all know if it works. – Andy Sep 23 '17 at 11:38
-
fresh install of wndows 10, installed SSMS 2017, SSMS upgrade then VS2017 community edition. No luck. Still no references on display. Might be going back 2 VS2015...or paying for professional! – Andy Sep 29 '17 at 20:51
-
This does not use SSMS 2017... it uses SMSS 2016 which has the option in the installer to add SSDT.... Is that what you are trying to do? – petrosmm Oct 02 '17 at 16:00
We can Go tools => Options => Text Editor => All languages => CodeLens to find the dialog box we need. After that, the reference can work normally.

- 491
- 4
- 9