Building doNet 5 and net core 3.1.x apps Failed

Hi guys, i facing a problem in this enviroment

  • Azure DevOps to run my pipeline
  • Bitbucket as code repository.
  • the error raised when → Running task DotNetCoreCLI@2 after SonarCloudPrepare@1
  • Language C#

trying to build and connect my pipeLine with sonarCloud i have a .net 5.0.x project and .net core 3.1.x , when build the project normally works ok , but when start to add the sonar cloud task starst to fail.

with the next yalm my build is working fine :

```
trigger:
- qa
- develop
- master

resources:
- repo: self

variables:
  tag: '$(Build.BuildId)'

stages:
- stage: Build
  displayName: Build image
  jobs:  
  - job: Build
    displayName: Build
    pool:
      vmImage: 'windows-latest'
    steps:


    - task: UseDotNet@2
      displayName: 'Install .NET 5.x.x SDK'
      inputs:
        version: '5.0.x'
        performMultiLevelLookup: true
        includePreviewVersions: true # Required for preview versions
    
    - task: UseDotNet@2
      displayName: Use Dot Net Core 3.1.x
      inputs:
        packageType: 'sdk'
        version: '3.1.x'

    - task: DotNetCoreCLI@2
      inputs:
         command: 'build'
         projects: '**/*.sln'
      displayName: 'dotnet build'
```

But when i add SonarCloudPrepare@1 before my build :

```
trigger:
- qa
- develop
- master

resources:
- repo: self

variables:
  tag: '$(Build.BuildId)'

stages:
- stage: Build
  displayName: Build image
  jobs:  
  - job: Build
    displayName: Build
    pool:
      vmImage: 'windows-latest'
    steps:


    - task: UseDotNet@2
      displayName: 'Install .NET 5.x.x SDK'
      inputs:
        version: '5.0.x'
        performMultiLevelLookup: true
        includePreviewVersions: true # Required for preview versions
    
    - task: UseDotNet@2
      displayName: Use Dot Net Core 3.1.x
      inputs:
        packageType: 'sdk'
        version: '3.1.x'

    - task: SonarCloudPrepare@1
      inputs:
        SonarCloud: 'tp-survey'
        organization: 'teleperformance-sonarcloud'
        scannerMode: 'MSBuild'
        projectKey: tp-cm-back-survey
        projectName: 'tp-cm-back-survey'
        extraProperties: |       
          sonar.exclusions="**/bin/**/*,**/obj/**/*,**/Migrations/**,**/*.dll"
          sonar.coverage.exclusions="test/**"
          sonar.cs.roslyn.ignoreIssues=true
          sonar.verbose=true
    - task: DotNetCoreCLI@2
      inputs:
         command: 'build'
         projects: '**/*.sln'
      displayName: 'dotnet build'
```

I getting this error :

```
Command-line syntax error : 'D:\a\1\s\TPSurveyUnitTest\bin\Debug\.netcoreapp,version=v5.0\TPSurveyUnitTest.dll.RoslynCA.json' is not a valid value for the '/errorlog:' option. The value must be of the form '<file>[,version={1|1.0|2|2.1}]'. [D:\a\1\s\TPSurveyUnitTest\TPSurveyUnitTest.csproj]
    181 Warning(s)
    1 Error(s)
```

I trying installing before the sonarPrepare task the net core version 2.2.x and the result is the same.

Can you help me with this ?

Thanks in advance.

Hi @Ivalberto ,

Is this property put on purpose ? Can you try to remove it and test again to see if at least that changes something ?

Thanks.

Hi @mickaelcaro i removed the property but the result is the same.

Closing as a duplicate.