Sonar-dotnet: Error about missing ProjectGuid for .NET Core projects

Created on 12 Mar 2019  路  3Comments  路  Source: SonarSource/sonar-dotnet

Description

SonarQube is not able to correctly handle the "new" csproj format. It always requires the otherwise useless <ProjectGuid> entry in the csproj.

The "new" csproj format is all about conciseness and minimalism adding back all those useless XML elements defeats its whole purpose.

Repro steps

  1. Create a new .NET Core project using dotnet new or Visual Studio including a Solution file.

  2. Run it through SonarQube Analysis

Expected behavior

SonarQube correctly analyzes and reports the analysis about my solution. Without having to add a <ProjectGuid> to the csproj.

Actual behavior

The projects are not analysed and the following error occurs:

WARNING: The following projects do not have a valid ProjectGuid and were not built using a valid solution (.sln) thus will be skipped from analysis...

Known workarounds

Add a <ProjectGuid> to the csproj with an arbitrary unique guid value as described here and here.

Related information

  • SQ Version 7.6 (build 21501)
  • Visual Studio 2019 RC

Most helpful comment

If it helps anyone, this PowerShell script will find all of your .csproj files and add a ProjectGuid if it's missing.

https://github.com/ikemtz/NRSRx/blob/master/sonarqube-create-project-guids.ps1

All 3 comments

Hi @bitbonk,

I am closing this issue as duplicates of this issue https://github.com/SonarSource/sonar-scanner-msbuild/issues/659

Feel free to subscribe to the other issue to get notified about the fix!

Cheers,
Amaury

If it helps anyone, this PowerShell script will find all of your .csproj files and add a ProjectGuid if it's missing.

https://github.com/ikemtz/NRSRx/blob/master/sonarqube-create-project-guids.ps1

If it helps anyone, this PowerShell script will find all of your .csproj files and add a ProjectGuid if it's missing.

https://github.com/ikemtz/NRSRx/blob/master/sonarqube-create-project-guids.ps1

The updated link is https://github.com/ikemtz/NRSRx/blob/master/tools/sonarqube-create-project-guids.ps1

Was this page helpful?
0 / 5 - 0 ratings