Suppress Warnings VSBuild@1 MSBuildArgs

Copper Contributor

Hi,

 

I have several VSBuild@1 tasks in azure_pipelines.yml.

 

The C++\C# projects generate many warnings (3k+) at build time:

 

blashmet_0-1656518765616.png

 

From the documentation here, I have tried passing several different parameters to msbuildArgs in order to suppress the warnings, but they still show up every build (e.g., -verbosity:quiet, -consoleloggerparameters:ErrorsOnly, /p:WarningLevel=0, /NoWarn, etc.).

Am I missing something with the syntax or are there different flags that I should be passing to msbuildArgs?

 

Note, I do not want to specify the exact warnings to supress (required by some flags). I'd like to output errors only for a cleaner build page.

 

- task: VSBuild@1
  displayName: "Building..."
  inputs: 
    configuration: $(Config)
    msbuildArgs: "-maxCpuCount -consoleloggerparameters:ErrorsOnly"
    platform: $(buildPlatform)
    solution: $(solution)
    vsVersion: "${{ parameters.CSharpVsVersion }}"

 

Any help is appreciated :)

 

-Brandon

1 Reply

Temporary solution:

- name: msbuildArgs
    type: string
    default: "-maxCpuCount
      -consoleloggerparameters:ErrorsOnly
      -property:WarningLevel=0
      -property:RunCodeAnalysis=false
      -noWarn:C4244,C4267,C4311,C4302,C4477,C4838,MSB3245,MSB3277,MSB3270,MSB3042,C4996,C4101,C4312,C4474,LNK4099,C4715,LNK4017,C4091,C4334,C4700,C4192,C4129,C4805"

 Then pass msbuildArgs to the steps:

 

- ${{ each project in parameters.CPlusPlusProjects }}:
    - task: VSBuild@1
      displayName: "Building ${{ project }}"
      inputs:
        solution: ${{ project }}
        platform: ${{ parameters.buildPlatform }}
        configuration: ${{ parameters.buildConfiguration }}
        vsVersion: ${{ parameters.CPlusPlusVsVersion }}
        msbuildArgs: ${{ parameters.msbuildArgs }}
        logFileVerbosity: quiet

 

Note, multi-line object doesn't work for the msbuildargs parameter, each separate parameter can exist on it's own line, but each error code cannot. For example, the below will not work:

  - name: msbuildArgs
    type: string
    default: "-maxCpuCount
      -consoleloggerparameters:ErrorsOnly
      -property:WarningLevel=0
      -property:RunCodeAnalysis=false
      -noWarn:C4244,
C4267,
C4311,
C4302,
C4477,
C4838,
etc...