[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More


Visual Studio Block "C-Style" Comments: Incredible Annoyance Solved!

Published on
10,346 Points
1 Endorsement
Last Modified:
If you have ever tried to use "C-style" or "block" comments in recent versions of Visual Studio, undoubtedly you have been annoyed. C-style comments look like this:

Some long-winded comments in here.

But Microsoft makes it irritating for you to create this type of comment, because, by default, when you try to do it, VS tries to second-guess you and screws up your commenting. It does this to you:

* /

In summary, each time you hit enter after a c-style comment, VS puts an asterisk at the start of each line, and then when you try to put the end tag, it makes a space between the asterisk and the forward-slash, which defeats the commenting and forces you to manually go back and clean up.

I cursed about this "feature" for years until I recently found a simple solution:

In Visual Studio 2010 (and I believe this works for older versions as well) do the following:

Click Tools, Options, Text Editor, C#, Advanced -->  UNCHECK "Generate XML documentation comments for ///".

After you do this, the first time you try block comments and VS doesn't maliciously hose up your comment tags, you might shout for joy, sing, or some other such outburst.

Incidentally, there are some other Visual Studio settings that are a must-have for me:

Startup - Under Tools, Options, Environment, Startup, you can set VS to not do anything upon startup. Not load the annoying content, etc. Just startup and be ready.
Track Active Item in Solution Explorer - By default VS doesn't highlight the file in Solution Explorer while you're currently in that file in the editor. To change that, go into Tools, Options, Projects and Solutions, Track Active Item in Solution Explorer
Delete all breakpoints - I work with breakpoints a lot and often like to delete all of them with one fell swoop. This can be done with CTRL-SHIFT-F9. But there's an annoying prompt that asks if you're SURE you want to delete all these breakpoints. Get rid of the prompt by going to Tools, Options, Debugging, General - UNcheck "Ask before deleting all breakpoints".

Featured Post

Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Join & Write a Comment

Suggested Articles

Key to your CPU's ability to stay cool is to use the right amount of thermal paste and apply it correctly. In other words you want as much thermal conductivity between CPU and the cooling block. Use a quality thermal paste and apply it in a manner…
Basic Overview of office 365 user portal

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month