How do I add line numbers in Microsoft Visual Studio?
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.
Note-
This is how to do it in VS 2013. Other versions may have the "Line numbers" option listed under Text Editor => General, as shown in the screen shot below-