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

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".

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.