9

Trying to suppress warnings in Azure DevOps pipeline using .NET Core CLI task (DotNetCoreCLI@2), but getting the following error:

MSBUILD : error MSB1001: Unknown switch. Switch: --noWarn:MSB3277

Here is an example of the code, which is similar to how the switch is used in a couple of posts I found related to msbuild cli reference:

- task: DotNetCoreCLI@2
  displayName: Release Build
  inputs:
    command: 'build'
    projects: '${{ parameters.solutionPath }}'
    arguments: --configuration Release --noWarn:MSB3277

I have tried lowercase --nowarn as well, but still no luck, so any help with this issue would be gratefully appreciated.

Thanks in advance for your support,

Terry

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
Terry
  • 117
  • 1
  • 5

2 Answers2

13

Please use /nowarn:msb3277

- task: DotNetCoreCLI@2
  displayName: Release Build
  inputs:
    command: 'build'
    projects: '${{ parameters.solutionPath }}'
    arguments: --configuration Release /nowarn:msb3277
Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
5

To remove all messages apart from errors /clp:ErrorsOnly can do the trick, for example dotnet build /clp:ErrorsOnly.

In general this is not a good idea to hide warning messages but can be handy in certain situations where a third party library is clogging the CI build logs.

nilobarp
  • 3,806
  • 2
  • 29
  • 37