I know that you said you want to avoid the user registrar, but ... I also wanted to get the error output to stderr and found that the user registrar record was not so painful - 1 class with 1 method with 1 expression:
using Microsoft.Build.Utilities; using Microsoft.Build.Framework; public class ErrorOnlyLogger : Logger { public override void Initialize(IEventSource eventSource) { eventSource.ErrorRaised += (s, e) => { System.Console.Error.WriteLine( "{0}({1},{2}): error {3}: {4} [{5}]", e.File, e.LineNumber, e.ColumnNumber, e.Code, e.Message, e.ProjectFile); }; } }
In this case, the same error formatting as msbuild is used. This works with the msbuild 14.0.25420.1 command line. The code refers to the Microsoft.Build.Utilities.Core.dll and Microsoft.Build.Framework.dll files in C: \ Program Files (x86) \ MSBuild \ 14.0 \ Bin. I add /logger:ErrorOnlyLogger,path\ErrLogger.dll to the command line to call it.
unbob source share