Skip to content

NuGet pack raises a warning, which is turned into an error, but the build still passes #4842

@eerhardt

Description

@eerhardt

I'm building NuGet packages in my repo, and newer SDKs are now raising a warning (which my project says warnings as errors) but that isn't causing my build to fail.

C:\Program Files\dotnet\sdk\3.0.100\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(198,5): error NU5048: The 'PackageIconUrl'/'iconUrl' element is deprecated. Consider using the 'PackageIcon'/'icon' element instead. Learn more at https://aka.ms/deprecateIconUrl [F:\git\machinelearning\pkg\Microsoft.ML.CpuMath\Microsoft.ML.CpuMath.nupkgproj]

Steps to reproduce

  1. Unzip MSBuildBug.zip
  2. dotnet build
    notice the red errors, but the output saying Build succeeded.
  3. echo $LASTEXITCODE

returns: 0

Expected behavior

I expect the build should fail if there are errors during the build.

Actual behavior

The build prints errors to the console (even in red), but the build succeeds and the $LASTEXITCODE returns 0. So this won't fail any Azure DevOps CI builds.

Environment data

> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions