Skip to content

MSBUILDWARNINGSASMESSAGES not suppressing intermittently #4486

@paeppers

Description

@paeppers

Steps to reproduce

Either include a project sample, attach a zipped project, or provide IDE / CLI steps to create the project and repro the behaviour. Example of a project sample:

Project file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    ...
    <MSBUILDWARNINGSASMESSAGES>MSB3245</MSBUILDWARNINGSASMESSAGES>
  </PropertyGroup>
  ...

Directory contents:

/
- dirs.proj
- src/
     - dirs.proj
     - dir1/
          - app.config
          - myproj.csproj
     ...

Command line

& $msbuild @($proj, '/nologo', '/nr:false', '/t:Clean', '/t:Build', '/m', '/p:MSBUILDWARNINGSASMESSAGES=MSB3277', '/warnaserror')
if ($?)
...

or generally, since we have the MSBUILDWARNINGSASMESSAGES element in the offending .csproj's,

msbuild /warnaserror

Expected behavior

build succeeds always - the warnings are always messages, and never get elevated to errors

Actual behavior

Command 1 will fail. When Command 1 fails, $? can however return success.

Command 2 may or may not fail. When Command 2 fails, it can be for any of the projects we already 'fixed' with MSBUILDWARNINGSASMESSAGES.

Environment data

msbuild /version output:

Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

16.1.76.45076

OS info:

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
vs 2019 developer command prompt v16.1.4
also, separately,
Powershell
Major Minor Build Revision


5 1 18362 145

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions