ALM used: Azure DevOps
CI system used: Azure DevOps
SonarCloud Tooling tasks.
-
SonarCloudPrepare@2
Scanner Version: 9.0.0.100868 (also experienced in v8)
ScannerMode: MSBuild -
SonarCloudAnalyze@2
JDK version: JAVA_HOME_21_X64 -
SonarCloudPublish@2
Languages of the repository: C#
NET 8, C#
Error observed
Building a solution that has a reference to a class lib (All is NET 8)
The build fails when building the Class Lib with the error that the project does not have a valid GUID.
See error details below.
2024-10-14T05:05:31.9777693Z ##[debug]Processed: ##vso[task.logdetail id=f93c51be-4afc-4546-a594-cac4bbba74b7;parentid=;name=SonarQube.Integration.targets;type=Build;starttime=2024-10-14T05:05:30.4262925Z;state=InProgress;]
2024-10-14T05:05:32.0005078Z ##[error]/home/vsts/work/1/.sonarqube/bin/targets/SonarQube.Integration.targets(373,5): Error : The project does not have a valid ProjectGuid. Analysis results for this project will not be uploaded. Project file: /home/vsts/work/1/s/src/OBFUSCATED.Serilog/OBFUSCATED.Serilog/OBFUSCATED.Serilog.csproj
2024-10-14T05:05:32.0135945Z ##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=/home/vsts/work/1/.sonarqube/bin/targets/SonarQube.Integration.targets;linenumber=373;columnnumber=5;code=;]The project does not have a valid ProjectGuid. Analysis results for this project will not be uploaded. Project file: /home/vsts/work/1/s/src/OBFUSCATED.Serilog/OBFUSCATED.Serilog/OBFUSCATED.Serilog.csproj
2024-10-14T05:05:32.0139016Z ##[debug]Processed: ##vso[task.logdetail id=f93c51be-4afc-4546-a594-cac4bbba74b7;parentid=;type=Build;result=Failed;finishtime=2024-10-14T05:05:30.4344376Z;progress=100;state=Completed;parentid=;name=;]
2024-10-14T05:05:32.0139837Z 05:05:30.423 4:2>/home/vsts/work/1/.sonarqube/bin/targets/SonarQube.Integration.targets(373,5): error : The project does not have a valid ProjectGuid. Analysis results for this project will not be uploaded. Project file: /home/vsts/work/1/s/src/OBFUSCATED.Serilog/OBFUSCATED.Serilog/OBFUSCATED.Serilog.csproj [/home/vsts/work/1/s/src/OBFUSCATED.Serilog/OBFUSCATED.Serilog/OBFUSCATED.Serilog.csproj]
2024-10-14T05:05:32.0141203Z Assembly loaded during TaskRun (SonarScanner.MSBuild.Tasks.WriteProjectInfoFile): System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (location: /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.8/System.Runtime.Serialization.dll, MVID: 64febcfc-7680-493a-9ce5-19ca0f2e9947, AssemblyLoadContext: Default) (TaskId:149)
2024-10-14T05:05:32.0142313Z Assembly loaded during TaskRun (SonarScanner.MSBuild.Tasks.WriteProjectInfoFile): Microsoft.GeneratedCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (location: , MVID: a64f8864-e5db-4733-b2bb-3ac5fafa7b2b, AssemblyLoadContext: MSBuild plugin /home/vsts/work/1/.sonarqube/bin/SonarScanner.MSBuild.Tasks.dll) (TaskId:149)
2024-10-14T05:05:32.0142849Z Done executing task "WriteProjectInfoFile". (TaskId:149)
2024-10-14T05:05:32.0143117Z Task "Message" (TaskId:150)
2024-10-14T05:05:32.0143427Z Task Parameter:Text=Sonar: (OBFUSCATED.Serilog.csproj) Project processed successfully (TaskId:150)
2024-10-14T05:05:32.0143766Z Task Parameter:Importance=high (TaskId:150)
2024-10-14T05:05:32.0144076Z Sonar: (OBFUSCATED.Serilog.csproj) Project processed successfully (TaskId:150)
2024-10-14T05:05:32.0144372Z Done executing task "Message". (TaskId:150)
Full diagnostic log uploaded to file.io as zip file.
It seems it is not possible to upload zip files here and diag logs are very big and are bigger than. you allow.
Get log here (Available for 2 weeks max)
https://file.io/dkfxxZ4QQ1cJ
CSPROJ for problematic class lib
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="5.0.0" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0"/>
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.OpenTelemetry" Version="1.0.0-preview1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="Serilog" Version="4.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2"/>
<PackageReference Include="Serilog.Sinks.Seq" Version="8.0.0"/>
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="4.0.0"/>
</ItemGroup>
</Project>
Steps to reproduce
- Create NET 8 solution (Minimal API f.ex)
- Create Class Lib
- Create reference from primary project to class lib
- Build using the SLN file in Azure devops. and DO NOT ALLOW WARNINGS
Potential workaround
- Allow warnings and the build succeeds