Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add to the MESSAGES list in the Visual Studio Error List window?

#error shows in errors, #warning in warnings. How can I make a line of text appear in the messages filter of the Error List window?

To clarify:

If I place the following line within a C# code file, it will generate an error on build, and that error will appear in the Error List window if I switch the errors on (like tabs above the list, there are buttons to toggle Errors, Warnings, and Messages).

#error This will cause a divide by zero

The same can be done to inject warnings into the build output:

#warning This might produce a NullReference exception

What would I place in the C# code file to have a message like that appear in the Messages list?

like image 333
Bernhard Hofmann Avatar asked Feb 17 '10 11:02

Bernhard Hofmann


2 Answers

You may use TasksList. On the View menu, point to Other Windows and then click Task List. The Task List is displayed. In the Categories list, click Comments. The Comments list displays the comment text and appears there whenever you open and edit the code file. You can click any Task List comment to activate the file in the Code Editor and jump to the line of code that the comment marks. You may use //TODO, //HACK, //UNDONE or you specified custom comments.

like image 146
necrostaz Avatar answered Sep 24 '22 08:09

necrostaz


The short answer: You can't.

If you want to communicate with the builder of your code, use warnings or errors as these appear in all builds, not just in Visual Studio.

like image 31
Bernhard Hofmann Avatar answered Sep 24 '22 08:09

Bernhard Hofmann