开发者

How to disable the automatic asterisk in Visual Studio when adding a multi-line comment in C#? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

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

When adding a multi-line comment开发者_StackOverflow社区 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.


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.


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.

How to disable the automatic asterisk in Visual Studio when adding a multi-line comment in C#? [duplicate]

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜