Skip to content

MSBuild occasionally succeeds despite /WarnAsError:MSB3270 #5689

@atniomn

Description

@atniomn

Issue Description

When running MSBuild with /WarnAsError:MSB3270, MSBuild will occasionally succeed, despite warnings being promoted into an errors.

I do not observe this behavior with /graph:true

Steps to Reproduce

I notice there are many other issues similar to this one, so I took it upon myself to construct a reliable reproduction of the issue.

WarnAsErrorTest.zip

The code attached contains a really simple C# solution (.NET Framework 4.7.2 console application) which deliberately has misaligned platforms.

I have included a powershell script, test.ps1, which can be run with /graph:false

PS WarnAsErrorTest> .\test.ps1

or with /graph:true

PS WarnAsErrorTest> .\test.ps1 -GraphBuild $true

Expected Behavior

Regardless of whether or not I am using /graph:true, MSBuild should fail in a deterministic manner

Actual Behavior

MSBuild fails most of the time, but occasionally succeeds.

Versions & Configurations

Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

16.6.0.22303

pwsh v7.0.3

I recommend /graph:true to anyone experiencing this problem.
I understand the historic justification for having /graph:false be default, but /graph:true seems much more sane now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions