43

Possible Duplicate:
How do I stop visual studio from automatically inserting asterisk during a block comment?

When adding a multi-line comment in Visual Studio, it automatically places an asterisk (*) at the beginning of a new line (on enter) inside the comment block. I personally find this a nuisance. Does anyone know how to disable it? Thanks.

Community
  • 1
  • 1
Zoman
  • 2,047
  • 4
  • 28
  • 44
  • 3
    duplicate: http://stackoverflow.com/questions/51180/how-do-i-stop-visual-studio-from-automatically-inserting-asterisk-during-a-block – Rob van Groenewoud Feb 21 '10 at 22:02
  • 2
    There is a uservoice suggestion to improve this http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2947213-don-t-create-asterisk-for-new-lines-within-block-c – Martin Brown Jun 22 '12 at 15:09

2 Answers2

30

Found this answer for you online (see here):

This works with Visual Studio 2005 and 2008:

  1. in the IDE, go to Tools->Import and Export Settings; then Export selected environment settings; deselect everything except Options->Text Editor; save to a new file.

  2. Edit your exported settings file in some text editor. Search for the string "AutoComment". There's a PropertyValue tag with value 1, change it to 0, and save the file.

  3. in the IDE, import this new file using Tools->Import and Export Settings. It should stop formatting comments right away.

To be clear, I haven't tested it myself yet . . . please let us know if it works for you.

Update:

Another way, as posted in the previous question on this (linked by Rob van Groenewoud, above)

Tools > Options... > Text Editor > C# > Advanced > Uncheck "Generate XML Documentation comments for ///".

(Of course, in addition to getting rid of the automatic * in block comments, this will disable the autoformatting when you type "///", as it says.)

It sounds like the solution I gave above does the same thing, but by editing the settings file itself instead of using the menu options.

Tim Goodman
  • 23,308
  • 7
  • 64
  • 83
  • 1
    It works in Visual Studio 2010, but changing the AutoComment string in exported settings works really exactly the same as unchecking "Generate XML Documentation comments". So it also stops generating XML comments :( – jirkamat Feb 07 '14 at 07:47
  • @jirkamat install [GhostDoc](http://submain.com/products/ghostdoc.aspx) so that you can generate the XML doc by pressing `Ctrl+Shift+D` – Tomasz Pluskiewicz Nov 27 '14 at 09:10
  • Thank you so much! The disabling "Generate XML Documentation" works in Visual Studio 2013. – mjquito Oct 16 '18 at 15:44
  • If you're in 2019, and looking for how to do this for C++, the same process works, except you have to look for "continuecommentsonenter" and change the boolean. – John Raptis Mar 29 '21 at 00:10
  • Just in case, for C++ users (at least ver 16.11): "Insert existing comment style at the start of new lines when writing comments" under Tools > Options > Text Editor > C/C++ > Code Style > General – Vladimir Gamalyan Nov 20 '21 at 04:57
29

I would have left this as a comment on John Saunders' answer, but alas, my rep is not high enough :)

Vertical Selections

If you'd rather not be editing settings files, or you want to keep the automatic xml comment generation on typing "///", you could use vertical highlighting to select all the asterices and hit delete. Visual Studio, like Microsoft Office, gives you the ability to select a "column" of text: just hold alt and click-drag your selection across several lines.

Cool!

It's possible you know this already, but it's still worth mentioning.

Community
  • 1
  • 1
Seb Charrot
  • 2,816
  • 1
  • 22
  • 24