Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the <Message> MSBuild task to show up in the Visual Studio project output?

I'm trying to printf debug my Visual Studio project file by spewing messages to the console like this:

<Target Name="BeforeBuild">   <Message Text="+++++++++++++++++++++++ Justin Dearing ++++++++++++++++++++++++++++++++++++" /> </Target> 

This works from the command line:

BeforeBuild:   +++++++++++++++++++++++ Justin Dearing ++++++++++++++++++++++++++++++++++++ 

However, the messages don't show up in the Visual Studio 2010 build output. Is there an alternative MSBuild task I can use, or a setting in Visual Studio I can enable to make these messages appear?

like image 954
Justin Dearing Avatar asked Sep 26 '11 15:09

Justin Dearing


People also ask

How do I use MSBuild in Visual Studio?

To install MSBuild on a system that doesn't have Visual Studio, go to Build Tools for Visual Studio 2019, or install the . NET SDK. If you have Visual Studio, then you already have MSBuild installed. With Visual Studio 2022, it's installed under the Visual Studio installation folder.

Does Visual Studio call MSBuild?

Visual Studio uses MSBuild, but MSBuild doesn't depend on Visual Studio. By invoking msbuild.exe on your project or solution file, you can orchestrate and build products in environments where Visual Studio isn't installed.

What is the default value of importance property for message task in MSBuild?

Message importance can have a value of high , normal or low . The default value is normal .

Where can I find MSBuild?

MSBuild is installed in the \Current folder under each version of Visual Studio, and the executables are in the \Bin subfolder.


2 Answers

Add the Importance attribute with value High to Message.

Like this:

<Message Importance="High" Text="+++ Justin Dearing +++" /> 
like image 181
Devin Gleason Lambert Avatar answered Oct 08 '22 19:10

Devin Gleason Lambert


To change the build output verbosity shown in the Visual Studio 2010 window, open the Options dialog and select the Build and Run settings below the Projects and Solutions node.

Unless you explicitly specify a low message importance, your messages should show up at Normal verbosity or higher.

like image 27
Thomas Gerstendörfer Avatar answered Oct 08 '22 21:10

Thomas Gerstendörfer