Start a new topic

MSBuild Command-Line Erros and Warning

Using MSBUILD to build DuoCode projects DOES NOT fire eventSource.WarningRaised and eventSource.ErrorRaised events 

if i compile a NON-Duo code project the events fire JUST FINE.


Is there something about the csproj that calls dcc.exe differently from if the MSBUILD doing a regular build with csc.exe (mcs.exe).


Can i do something in the csproj to make those events fire.


Here is the SIMPLE Logger class i am trying to use during my MDPLUS API call:


Again works fine for ALL msbuild projects EXCEPT for DuoCode... I assume it has something to do with the way dcc.exe is overriding the csproj file:



public class ProblemLogger : Logger
{
Action<BuildMessage> _problem = null;
public ProblemLogger(Action<BuildMessage> problems)
{
_problem = problems;
}

public override void Initialize(IEventSource eventSource )
{
eventSource.WarningRaised += (object sender, BuildWarningEventArgs e) => {
if (_problem != null) {
_problem (new BuildMessage() {
Type = MessageType.Warning,
File = e.File,
LineNumber = e.LineNumber,
ColumnNumber = e.ColumnNumber,
Code = e.Code,
Message = e.Message,
ProjectFile = e.ProjectFile
});
} else {
System.Console.WriteLine("===> Warning: {0}({1},{2}): {3} - {4}", e.File, e.LineNumber.ToString(), e.ColumnNumber.ToString(), e.Code, e.Message);
}
};
//
eventSource.ErrorRaised += (object sender, BuildErrorEventArgs e) => {
if (_problem != null) {
_problem (new BuildMessage() {
Type = MessageType.Error,
File = e.File,
LineNumber = e.LineNumber,
ColumnNumber = e.ColumnNumber,
Code = e.Code,
Message = e.Message,
ProjectFile = e.ProjectFile
});
} else {
System.Console.WriteLine("===> Error: {0}({1},{2}): {3} - {4}", e.File, e.LineNumber.ToString(), e.ColumnNumber.ToString(), e.Code, e.Message);
}
};

} 







DuoCode MSBUILD Task is using TextWriter and provided to task the TaskLoggingHelper instance.

It emits errors/warning using:

log.LogMessageFromText("some message from the compiler", MessageImportance.Normal);


I think Mono's TaskLoggingHelper.LogMessageFromText() is differ and don't raise event parsed as warning or error.

Likely Mono bug, can you try to run it with official MSBuild 14 builder not XMono/xbuild?


https://github.com/Microsoft/msbuild




To Clarify: When using xbuild on mac OSX ... Errors and Warning are NOT captured... It DOES show the error in the OUTPUT, but the API does NOT detect the Error. So if there was an error it still go on trying to compile and eventually try to run the project... EVEN THOUGH THERE WAS AN ACTUAL ERROR.


Attached is a simple xbuild output where i crete an error on purpose BUT the Error and warning count are 0:


Last login: Sat Feb 27 16:56:23 on ttys000

McArthurs-iMac:~ Mackey$ xbuild /Users/Mackey/Projects/HelloDuoCode/HelloDuoCode1/HelloDuoCode1.csproj

XBuild Engine Version 14.0

Mono, Version 4.3.2.0

Copyright (C) 2005-2013 Various Mono authors


Build started 2/27/2016 4:56:49 PM.

__________________________________________________

Project "/Users/Mackey/Projects/HelloDuoCode/HelloDuoCode1/HelloDuoCode1.csproj" (default target(s)):

 Target PrepareForBuild:

Configuration: Debug Platform: AnyCPU

 Target GenerateSatelliteAssemblies:

 No input files were specified for target GenerateSatelliteAssemblies, skipping.

 Target CompileDuoCode:

        _|    _   _ _  _| _  

  o  o  (_||_|(_) (_(_)(_|(-' 

DuoCode Compiler version 2.0.1542.0 (x86, Mono 4.3.2)

Powered by .NET Compiler Platform ("Roslyn") 1.1.0.51202

Registered to Mackey Kinard [Professional]

Program.cs(59,14): error CS0103: The name 'Programx' does not exist in the current context

Program.cs(60,12): error CS0103: The name 'Programx' does not exist in the current context

 Task "TaskDuoCode" execution -- FAILED

 Done building target "CompileDuoCode" in project "/Users/Mackey/Projects/HelloDuoCode/HelloDuoCode1/HelloDuoCode1.csproj".-- FAILED

Done building project "/Users/Mackey/Projects/HelloDuoCode/HelloDuoCode1/HelloDuoCode1.csproj".-- FAILED


Build FAILED.

  0 Warning(s)

  0 Error(s)


Time Elapsed 00:00:02.3589570

McArthurs-iMac:~ Mackey$  

Login or Signup to post a comment