Thursday, April 21, 2011

How to output messages to the VS output window, from msbuild?

I have tried adding <Message> elements to tasks in a VS project file, in order to debug the build process. However, the elements have no effect on the text that is written to the VS output window.

Is there a way to write messages to the VS output window, by adding markup to the project being built?

From stackoverflow
  • Maybe this can help?

    Under Tools – Options – Projects and Solutions – Build and Run, there’s the MSBuild project build output verbosity combo box. This controls how much info you want to see in the Output window.

    mackenir : Thanks, that did it. Even with Importance="high", Messages don't get written out to the Output window by default.
  • I think this should work (it used to for me): <Message Text="blah" />

    (And of course, from code, System.Diagnostics.Debug.WriteLine("blah");)

    Serge - appTranslator : Debug.WriteLine() outputs to the debug console at *run-time*
    Ariel : That's why I put "from code" above, right? Even more, nothing prevents you from writing a custom msbuild extension and use System.Diagnostics.Debug.WriteLine(), right?

0 comments:

Post a Comment