It would be good to get a response to the question below the dotted lines, but as I was submitting this, I found the following: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000" on dotnet core scan
In case this helps anyone else, I resolved the problem by building the solution rather than the main project:
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: '**/*.sln'
arguments: '--configuration $(BuildConfiguration) --no-restore'
(note the no-restore option as we restore prior to this).
It’s worth noting that this may not work if the solution has multiple build targets (some of ours do, but I’ve not tested them yet).
I’m trying to run sonarcloud on our .Net Core Solutions via Azure Pipelines (following documentation mentioned here), setup in YML seems correct, but I’m running into the following problem:
WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "D:\a\1\s\xxxxx.xxxxxx.Core\xxxxx.xxxxxx.Core.csproj"
WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "D:\a\1\s\xxxxx.xxxxxx.DataPersistence\xxxxx.xxxxxx.DataPersistence.csproj"
WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "D:\a\1\s\xxxxx.xxxxxx.Services\xxxxx.xxxxxx.Services.csproj"
WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "D:\a\1\s\xxxxx.xxxxxx.Services.Tests\xxxxx.xxxxxx.Services.Tests.csproj"
WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "D:\a\1\s\xxxxx.xxxxxx.Api\xxxxx.xxxxxx.Api.csproj"
This seems a well documented problem: here, here, here
and I can resolve it by running in repo containing the solution:
$paths = Get-ChildItem -include *.csproj -Recurse
foreach($pathobject in $paths)
{
$path = $pathobject.fullname
$doc = New-Object System.Xml.XmlDocument
$doc.Load($path)
$child = $doc.CreateElement("ProjectGuid")
$child.InnerText = [guid]::NewGuid().ToString().ToUpper()
$node = $doc.SelectSingleNode("//Project/PropertyGroup")
$node.AppendChild($child)
$doc.Save($path)
}
However, this isn’t a great solution as we are building a microservice environment and have many departments, so it’s additional overhead to document and get right. Especially when the projects do have GUIDs inside the solution file already. Is this really the solution? - it seems quite an old problem and the documentation doesn’t mention anything about this.