Just a few days ago Microsoft has released this nice free tool called "Microsoft Line Of Code Counter" that does just what the name says: it counts lines of code inside source code files. This tool is a Framework .NET 2.0 application that comes already configured to understand the syntax of a set of programming languages among which C#, VB.NET, C++, SQL, XML files (XML, XSL and XSD) and web files (aspx, ascx, css, htm, html, asp and js). It is highly configurable: you can edit the LineCounters.xml file that it installs to customize its out-of-the-box behavior. A nice feature of this tool is that it can do its counting job not only on source code files that reside on you file system but also on souce code files that are inside the Team Foundation Server or the Visual SourceSafe source control systems. You can download this tool here.
** UPDATE **
The line of code counter tool is now part of the "Visual Studio Code Metrics PowerTool 10.0" available here.