How to: Display Line Numbers in the Editor
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here
You can display or hide line numbering in your code.
Depending on your active settings, the dialog boxes and menu commands that appear might differ from the ones that are described here. To change your settings, open Tools / Import and Export Settings. For more information, see Customizing Development Settings in Visual Studio.
Display Line Numbers in Code
Line numbers aren't added to your code; they're just for reference. If you want line numbers to print, in the Print dialog box, select the Include line numbers check box.
To display line numbers in code
On the menu bar, choose Tools, Options. Expand the Text Editor node, and then select either the node for the language you are using, or All Languages to turn on line numbers in all languages. Or you can type line number in the Quick Launch box.
Depending on your language or settings, you may have to select the Show All Settings check box in the Options dialog box to reveal the All Languages sub-node.