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开发者_如何学C 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?
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.
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.
I think this is what you are looking for: http://www.mztools.com/articles/2008/MZ2008022.aspx
I stopped by this question because I was searching to do the same from my AddIn written in C# for Visual Studio 2010.
After a couple of minutes I finally got the answer in that link!
Unsure what you are asking? You basically want to see those errors and warnings displayed?
This may sound very basic but: 1) Make sure your Error List is displayed fully by making the window bigger so you see the headers Description, File, Line... 2) Click on the # Errors and # Warnings buttons at the top.
We tend to do what necrostaz suggested. We've defined our own INFO tag so we can put // INFO This is a message.
It would be good to find a way to generate an informational message, though.
精彩评论