Skip to main content

Error when running Sonar Cloud on .NET Core projects

Yesterday I talked about setting up Sonar Cloud for code analysis.

Unfortunately it turned out to be not so simple as I expected. The first time I ran the build pipeline the Code analysis task failed with the following error:

2020-09-14T17:47:52.6441174Z ##[section]Starting: Run Code Analysis

2020-09-14T17:47:52.6563714Z ==============================================================================

2020-09-14T17:47:52.6564026Z Task         : Run Code Analysis

2020-09-14T17:47:52.6564329Z Description  : Run scanner and upload the results to the SonarCloud server.

2020-09-14T17:47:52.6564583Z Version      : 1.15.0

2020-09-14T17:47:52.6564794Z Author       : sonarsource

2020-09-14T17:47:52.6565319Z Help         : Version: 1.15.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](https://sonarcloud.io/documentation/analysis/scan/sonarscanner-for-azure-devops/)

2020-09-14T17:47:52.6565909Z ==============================================================================

2020-09-14T17:47:52.9698863Z [command]D:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.12.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end

2020-09-14T17:47:53.0469811Z SonarScanner for MSBuild 4.10

2020-09-14T17:47:53.0470290Z Using the .NET Framework version of the Scanner for MSBuild

2020-09-14T17:47:53.0984270Z Post-processing started.

2020-09-14T17:47:54.3358218Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.shared\bridges.cms.modules.contentcreation.shared.csproj"

2020-09-14T17:47:54.3359968Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.infrastructure\bridges.cms.modules.contentcreation.infrastructure.csproj"

2020-09-14T17:47:54.3361069Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.domain\bridges.cms.modules.contentcreation.domain.csproj"

2020-09-14T17:47:54.3362264Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.application\bridges.cms.modules.contentcreation.application.csproj"

2020-09-14T17:47:54.3364005Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.dataaccess\bridges.cms.modules.contentcreation.dataaccess.csproj"

2020-09-14T17:47:54.3365002Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.archtests\bridges.cms.modules.contentcreation.archtests.csproj"

2020-09-14T17:47:54.3366234Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.integrationtests\bridges.cms.modules.contentcreation.integrationtests.csproj"

2020-09-14T17:47:54.3367348Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.api\bridges.cms.api.csproj"

2020-09-14T17:47:54.3368778Z WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "d:\a\1\s\bridges.cms.modules.contentcreation.unittests\bridges.cms.modules.contentcreation.unittests.csproj"

2020-09-14T17:47:54.3370405Z ##[error]No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.

2020-09-14T17:47:54.3371973Z No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.

2020-09-14T17:47:54.3431567Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.

2020-09-14T17:47:54.3479798Z ##[error]17:47:54.346  Post-processing failed. Exit code: 1

2020-09-14T17:47:54.3481669Z 17:47:54.346  Post-processing failed. Exit code: 1

2020-09-14T17:47:54.3668330Z ##[error]The process 'D:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.12.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1

2020-09-14T17:47:54.3739014Z ##[section]Finishing: Run Code Analysis

The problem is that SonarCloud expects a ProjectGuid to be able to differentiate between the different C# projects(.csproj files ) I have in my source repository. As this are .NET Core projects such a ProjectGuid no longer exist.

To solve this problem I changed my dotnet build task to use the solution file instead of using csproj files:

Popular posts from this blog

DevToys–A swiss army knife for developers

As a developer there are a lot of small tasks you need to do as part of your coding, debugging and testing activities.  DevToys is an offline windows app that tries to help you with these tasks. Instead of using different websites you get a fully offline experience offering help for a large list of tasks. Many tools are available. Here is the current list: Converters JSON <> YAML Timestamp Number Base Cron Parser Encoders / Decoders HTML URL Base64 Text & Image GZip JWT Decoder Formatters JSON SQL XML Generators Hash (MD5, SHA1, SHA256, SHA512) UUID 1 and 4 Lorem Ipsum Checksum Text Escape / Unescape Inspector & Case Converter Regex Tester Text Comparer XML Validator Markdown Preview Graphic Color B

Help! I accidently enabled HSTS–on localhost

I ran into an issue after accidently enabling HSTS for a website on localhost. This was not an issue for the original website that was running in IIS and had a certificate configured. But when I tried to run an Angular app a little bit later on http://localhost:4200 the browser redirected me immediately to https://localhost . Whoops! That was not what I wanted in this case. To fix it, you need to go the network settings of your browser, there are available at: chrome://net-internals/#hsts edge://net-internals/#hsts brave://net-internals/#hsts Enter ‘localhost’ in the domain textbox under the Delete domain security policies section and hit Delete . That should do the trick…

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.