dotnet / dotnet/msbuild

warnaserror not failing the build with exit 1 if only errors present were warnings

Open
#9,825 30 comments 15 reactions 0 assignees View on GitHub
Area: Engine bug
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

When there are no errors in a build, but only warnings that have been promoted to error with **WarnAsError** then the build will not fail with an exit of 1.

```
$ dotnet build --no-incremental /WarnAsError

...

Build FAILED.

....cs(28,1): error SA1507: Code must not contain multiple blank lines in a row [....csproj]
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:01.55
Exit code => 0
```

Given that there are errors in the build, would expect an exit code of 1

Note that if there are genuine errors in the build, the build will fail correctly with the correct exit code

OS: Linux Ubuntu 18.04
dotnet version: 2.2.3-preview

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.