Error for .Net 6 projects: WARNING: Duplicate ProjectGuid: [] The project will not be analyzed

Lately I have noticed the error WARNING: Duplicate ProjectGuid: The project will not be analyzed. on a number of the projects we are buidling in out CI/CD pipeline in Azure. It seems it only happens on a subset of the projects, 10 out of the total of 69.

14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"
14:16:58.926  14:16:58.926  WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed. Project file: "/home/vsts/work/1/s/src/[snip].csproj"

According to This ticket this should not happen when you build a solution, but we build a solution:

The <ProjectGuid> element is not required if you build a solution (sln) containing that project

Also, as far as I can identify, the ProjectGuid is an obsolete property of csproj files.

Below the popeline we use:

  - task: SonarCloudPrepare@1
    displayName: 'Prepare analysis configuration'
    inputs:
      SonarCloud: 'SC'
      organization: '---'
      scannerMode: 'MSBuild'
      projectKey: '---'
      projectName: '---'
      extraProperties: |
       sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/*/coverage.opencover.xml
  
  - task: DotNetCoreCLI@2
    displayName: 'Build solution'
    inputs:
      command: 'build'
      projects: '**/*.sln'
      arguments: --configuration $(buildConfiguration)

  - task: SonarCloudAnalyze@1
    displayName: 'Run SonarCloud analysis'

  - task: SonarCloudPublish@1
    displayName: 'Publish results on build summary'
    inputs:
      pollingTimeoutSec: '300'

Hi,

Could you please share verbose logs for your job?

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

logs.zip (6.7 MB)
Here is the zip with both verbose logs.

Hi,

Thanks for the bundle. Unfortunately, I can’t open the analysis.txt file. Can you double-check it in a text editor and re-upload it, please?

 
Thx,
Ann

Hmm interesting. I can open it. Zipped it again, maybe it works now?
analysis.zip (721.4 KB)

Hi,

My text editor still shows me a blank page.

 
Ann

analysis.txt (11.4 MB)
Okay, maybe this works then. Otherwise I have no clue why it would show blank for you :thinking:

(just to make sure, it’s saved as UTF-8 and windows style line endings)

Hi,

Here’s what I get:

 
Ann

Really strange,

I just tested it with a few colleagues, and the file works fine on both Mac and Windows machines, so the file pre-upload seems fine.