VSBuild step Failed after "SonarCloudPrepare" step in AZURE Pipeline

We have SonardCloud scan pipeline which has a VSBuild step run after a “SonarCloudPrepare” step.
This was all wokring till about 2 weeks ago.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn\Microsoft.VisualBasic.Core.targets(41,5): error MSB6006: "vbc.exe" exited with code 255

We initially thought it was a problem with VS 2017 installation or a Nuget restore was not working. But after miuch struggle, we found that if we comment out the “SonarCloudPrepare” step, the pipeline will complete without problem. Here is the log of “SonarCloudPrepare” step:
tarting: SonarCloudPrepare

==============================================================================
Task         : Prepare Analysis Configuration
Description  : Prepare SonarCloud analysis configuration
Version      : 1.37.0
Author       : sonarsource
Help         : Version: 1.37.0. [More Information](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/)
==============================================================================
C:\agent\_work\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.37.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe begin /k:accesscorp_software_aspen_batch_process /o:accesscorp
SonarScanner for MSBuild 5.13
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
10:03:23.41  Updating build integration targets...
10:03:23.98  Fetching analysis configuration settings...
10:03:25.144  Provisioning analyzer assemblies for cs...
10:03:25.144  Installing required Roslyn analyzers...
10:03:25.144  Processing plugin: csharp version 9.5.0.73987
10:03:25.269  Processing plugin: vbnet version 9.5.0.73987
10:03:25.269  Processing plugin: securitycsharpfrontend version 10.1.0.21056
10:03:26.029  Provisioning analyzer assemblies for vbnet...
10:03:26.029  Installing required Roslyn analyzers...
10:03:26.029  Processing plugin: csharp version 9.5.0.73987
10:03:26.029  Processing plugin: vbnet version 9.5.0.73987
10:03:26.108  Incremental PR analysis: Base branch parameter was not provided.
10:03:26.108  Cache data is empty. A full analysis will be performed.
10:03:26.168  Pre-processing succeeded.
Finishing: SonarCloudPrepare

Hi,

Welcome to the community!

Please share verbose logs from the Scanner for .NET:

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • “SonarQubePrepare” or “SonarCloudPrepare” task’s extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@1
            inputs:
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'MSBuild'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
                sonar.verbose=true
        
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / “Run Code Analysis”)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d

or

dotnet build -v:d

 
Ann