HasLoggedErrors should respect MSBuildWarningsAsErrors #5511
Labels
Area: Engine
Issues impacting the core execution of targets and tasks.
changewave16.10
Partner request
triaged
Steps to reproduce
warnaserr.tar.gz
Expected behavior
Log.HasLoggedErrors
returnstrue
when the logged warning is treated as an error due toMSBuildWarningsAsErrors
, causing the build to stop afterMyTask
.Actual behavior
HasLoggedErrors
returnsfalse
, the build continues, and the outer target runs even after the task produced an error.Perhaps this is the intended behavior. If that's the case, is there a recommended way for tasks to check whether any of their warnings have been turned into errors?
We are using ToolTask (which relies on
HasLoggedErrors
by default) for the IL linker MSBuild task, and we don't want to continue the build if any errors were logged - otherwise we touch a file on disk that prevents the linker from running incrementally next time.Environment data
msbuild /version
output: 16.7.0.36003OS info: 18.04.1-Ubuntu
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc): dotnet cli
The text was updated successfully, but these errors were encountered: