Tutorial :MSBuild and IgnoreStandardErrorWarningFormat


I'm trying to write a MSBuild project that will generate html documentation using doxygen. I couldn't find anything about that on the net except for one example, which seems incomplete; it doesn't parse doxygen warnings.

I found that MSBuild's Exec task has parameters like IgnoreStandardErrorWarningFormat and CustomWarningRegularExpression. What is the "Standard Error/Warning Format" and what kind of REs are allowed in these properties?

Edit: ah, "Inside the Microsoft Build Engine" wrongly describes it as property in .NET 3.5, where it is actually from 4. No use for me...


The standard msbuild error/warning format is described here: http://blogs.msdn.com/b/msbuild/archive/2006/11/03/msbuild-visual-studio-aware-error-messages-and-message-formats.aspx.

In a nutshell, the format is:

MSBuild recognizes error messages and warnings that have been specially formatted by many command line tools that typically write to the console. For instance, take a look at the following error messages - they are all properly formatted to be MSBuild and Visual Studio friendly.

Main.cs(17,20): warning CS0168: The variable 'foo' is declared but never used   C:\dir1\foo.resx(2) : error BC30188: Declaration expected.  cl : Command line warning D4024 : unrecognized source file type 'foo.cs', object file assumed  error CS0006: Metadata file 'System.dll' could not be found.  

These messages confirm to special format that is shown below, and comprise 5 parts - the order of these parts are important and should not change:

Canonical Errors/Warnings

Origin (Required)

Origin can be blank. If present, the origin is usually a tool name, like 'cl' in one of the examples. But it could also be a file name, like 'Main.cs' shown in another example. If it is a file name, then it must be an absolute or a relative file name, followed by an optional parenthesized line/column information in one of the following forms:

(line) or (line-line) or (line-col) or (line,col-col) or (line,col,line,col)  

Subcategory (Optional)

Subcategory is used to classify the category itself further, and should not be localized.

Category (Required)

Category must be either 'error' or 'warning'. Case does not matter. Like origin, category must not be localized.

Code (Required)

Code identifies an application specific error code / warning code. Code must not be localized and it must not contain spaces.

Text (Optional)

User friendly text that explains the error, and must be localized if you cater to multiple locales.


The format is fully documented in the MSBuild source code here.


I can't find docs on it right now, but I think the standard error format is something like

.*(\d+(,\d+(,\d+,\d+)?)?)?: error .*:.*  .*(\d+(,\d+(,\d+,\d+)?)?)?: warning .*:.*  


c:\somefile.txt(10,20,10,30): error CMD1234: blarg  c:\somefile.txt(10,20): error CMD1234: yadda yadda  c:\somefile.txt: warning ARG5678: blah blah  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »