Duplicate GUID for DotNet core App but Not a duplicate

HI,
When publishing my results I get a warning about duplicate but can;t work out why!!

Versions

  • SonarQube Scanner 3.3.0.1492
  • Java 1.8.0_171 Oracle Corporation (64-bit)
  • Windows Server 2012 R2 6.3 amd64
  • SonarQube server 6.7.6
  • SonarScanner for MSBuild 4.6.2

CSproj file
includes

  <Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <ProjectGuid>{E0CBBEA7-EB59-494A-8FF2-C1507AC6F133}</ProjectGuid>
    <ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
    <AssemblyName>Example</AssemblyName>
  </PropertyGroup>
  <ItemGroup>
.....

I get this warning twice?

WARNING: Duplicate ProjectGuid: “e0cbbea7-eb59-494a-8ff2-c1507ac6f133”

Have checked all other projects – it’s not a duplicate,
I have used the fix in here Link
but no luck
Any help appreciated

Thanks

HI @GSK1976. Welcome to the community, and apologies for the delayed response.

Each time a project is built, the scanner creates a file called ProjectInfo.xml containing info about the build. The ProjectInfo.xml files are stored in uniquely-named directories under .sonarqube\out\[XXX] where [XXX] is 0, 1, 2 etc.

The scanner should only raise the “Duplicate Guid” warning if it finds ProjectInfo.xml files that have the same GUID but different project file paths. Could you check those files to see if this is what is happening?

Hello @GSK1976

Sorry for the delay in answering.
I cannot see upfront what’s wrong in your set up, except for the fact that you run SonarQube 6.7 (20 months old). Your Scanner for MSBuild is fairly recent which should be OK for now.
However, if investigations get complicated I may ask you later to upgrade Scanner for MSBuild to the latest 4.7.1, and possibly SonarQube to 7.9… hopefully not.

For now on, could you rerun you build in debug mode and send the full logs (of begin/build/end phases aka Prepare Analysis/Build/Run Analysis in Azure Dev Ops)
To run in debug add the /d:sonar.verbose=true option in the Begin/Prepare analysis step.

Thanks

Hi @OlivierK

Can I send you the logs in private message?

Thanks

Hi @duncanp

Sorry but getting the hang of this forum.

I have checked and I did have two files with that ref. In different numbers. They both ref the same folder.

I cleared down the .sonarqube folder but i am still getting the duplicates.

Thanks

Hello @GSK1976,
Let me post a closing comment after our private exchanges.

You have this duplicate GUID problem because of 2 simultaneous feats:

  • A bug in Sonar Scanner for MSBuild 4.6: See https://github.com/SonarSource/sonar-scanner-msbuild/issues/730
  • You made a case typo in your build job when running:
    dotnet publish "<redacted>.Web.Ui" -c debug.
    You should have run:
    dotnet publish "<redacted>.Web.UI" -c debug. (Uppercase I in UI).
    In theory the case does not matter on Windows, but due to the above bug (Scanner being case sensitive, even on windows) you have the problem.

To fix the problem simply upgrade to Scanner for MSBuild 4.7 (or the azure DevOps extension 4.8 that embeds scanner 4.7).
If you cannot upgrade, you can workaround the problem by making sure your respect the same case everywhere in your build.