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.
Another way to comment out one or more lines of code to select the lines and click on the Comment or UnComment button in the Text Editor toolbar. Shortcut: You can use Ctrl+K, Ctrl+C and Ctrl+K, Ctrl+U to Comment or Uncomment selected lines of text.
If you select a block of code and use the key sequence Ctrl+K+C, you'll comment out the section of code. Ctrl+K+U will uncomment the code.
They shortcut to comment out a block of code is "Ctrl+K, C" or "Ctrl+E, C" (as a reminder, I'm using the default C# settings in Visual Studio). To comment out a selection, we first highlight the code: And then just press "Ctrl+K, C": That's it.
Found this answer for you online (see here):
This works with Visual Studio 2005 and 2008:
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.
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.
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.
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.
It's possible you know this already, but it's still worth mentioning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With