Csc.exe error om MSBuild Rebuild

Must-share information (formatted with Markdown):
SonarQube

  • how is SonarQube deployed: AWS enterprise
  • what are you trying to achieve: code scan
  • what have you tried so far to achieve this: issue looks to be in msbuild rebuild - we’ve tried dotnet scanner .net version 6.1 + 5.15 and both have same error

When
SonarScanner.MSBuild.exe begin
and
MSBuild.exe Rebuild

Error only occurs on two projects out of 50+
.nuget\packages\microsoft.net.compilers\2.1.0\tools\Microsoft.CSharp.Core.targets(71,5): error MSB60
06: “csc.exe” exited with code 1.

All projects using same .NET version and compiler etc

Normal MSBuild 16.11 compiles whole solution with no issue

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

To be clear, are you saying that you get a compile error when you’ve run the begin command before compile - and only then? Running an independent compile works fine?

And can you provide full, debug logs?

Share the Scanner for .NET verbose logs

  • 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

 
Thx,
Ann