To print line numbers in Visual Studio .NET 2003, go to File – Page Setup, and check “Line numbers” in the lower-left hand corner. The line numbers will appear in the file, regardless whether you have line numbers displayed in the editor.
In Visual Studio 2005, we’ve moved this option to the Print dialog.
I should probably mention how to show line numbers in the editor. Go to Tools – Options – Text Editor – General page and check “line numbers”.