Skip to content

Build.proj restore filters out TreatWarningsAsErrors #15872

@tmds

Description

@tmds

@ViktorHofer I'm looking as to why I'm seeing some warnings as errors when building aspnetcore with --warnaserror false.

For example:

/home/tester/workdir/aspnetcore/src/Hosting/test/testassets/BasicLinkedApp/BasicLinkedApp.csproj : error NU1603: Warning As Error: BasicLinkedApp depends on Microsoft.NET.ILLink.Tasks (>= 10.0.0-preview.6.25277.101) but Microsoft.NET.ILLink.Tasks 10.0.0-preview.6.25277.101 was not found. Microsoft.NET.ILLink.Tasks 10.0.0-preview.6.25277.102 was resolved instead. [/tmp/tmp.X9Undgqi2t/sdk/10.0.100-preview.6.25277.101/NuGet.targets]

I found this:

RemoveProperties="$(_RemoveProps);TreatWarningsAsErrors"

From #5172 (comment), it seems the intent is to consistenly have TreatWarningsAsErrors=false to avoid re-restoring if the property changed due to the project config.

In my case, it seems this has the unintended effect of filtering out TreatWarningsAsErrors=false.

Could we change the above to setting it to false in Properties instead of filtering it out in RemoveProperties?

    <MSBuild Projects="@(_ProjectToRestore)"
             Properties="@(_SolutionRestoreProps);TreatWarningsAsErrors=false"
             RemoveProperties="$(_RemoveProps)"
             Targets="Restore"
             SkipNonexistentTargets="true"
             BuildInParallel="%(_ProjectToRestore.RestoreInParallel)"
             Condition="'$(Restore)' == 'true'"/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions