Error when analyzing .NET 6 project on SonarCloud

Hello @Tom_Howlett, thanks for update.

We have tried to run SonarCloudAnalyze@1 Azure DevOps task for our .NET 6 solution and reached strange error, here is screenshot :

We had install both 3.1 and 6.0 SDK’s on agent and don’t forget doing sonar prepare before build.

Can you please advice us what’s can be wrong ?

1 Like

Hello and welcome to the community

I’ve split your message to a new topic to comply with our community guideline (see FAQ - SonarSource Community).

We’ll need the logs:

  • please give us the verbose output of SonarCloudPrepare and SonarCloudAnalyze (see instructions here)
  • please give the output of running MSBuild in verbose mode (/v:d)


Hello, @Andrei_Epure , Thank you for such quick reply,

here is attached logs, build log I divided to 4 parts because of 4mb limitations for file here

SonarPrepareLog.txt (10.7 KB)
SonarAnalizeLog.txt (121.2 KB)
BuildLog1.txt (2.5 MB)
BuildLog2.txt (2.9 MB)
BuildLog3.txt (2.9 MB)
BuildLog4.txt (1.8 MB)

Looking forward for your advice, thanks you

Hello @Yevhen_Novytskyi

Thanks for the logs.


2021-11-23T17:48:06.4057901Z 17:48:06.399 ERROR: Error during SonarScanner execution
2021-11-23T17:48:06.4058965Z 17:48:06.399 INFO: ------------------------------------------------------------------------
2021-11-23T17:48:06.4062517Z ##[error]java.lang.IllegalStateException: The base directory of the module ‘3CDBEBBC-503D-4132-BEFC-091554528943’ does not exist: /tmp/jpa5hzfh.grh
at org.sonarsource.scanner.cli.Conf.setModuleBaseDir(
at org.sonarsource.scanner.cli.Conf.loadModuleConfigFile(
at org.sonarsource.scanner.cli.Conf.loadModulesProperties(
at org.sonarsource.scanner.cli.Conf.loadProjectProperties(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.main(

And from the logs:

2021-11-23T17:48:02.6788139Z 3CDBEBBC-503D-4132-BEFC-091554528943.sonar.projectName=bundle
2021-11-23T17:48:02.6788780Z 3CDBEBBC-503D-4132-BEFC-091554528943.sonar.projectBaseDir=/tmp/jpa5hzfh.grh
2021-11-23T17:48:02.6789580Z 3CDBEBBC-503D-4132-BEFC-091554528943.sonar.sourceEncoding=utf-8
2021-11-23T17:48:02.6790154Z 3CDBEBBC-503D-4132-BEFC-091554528943.sonar.sources=

So this project seems to have no sources and to be in a temporary folder. It seems that this is probably auto-generated and after the build it gets deleted.

Could you share more around how you are using the analysis? Are you generating a temporary project during the build? How are you doing that?

If you’d rather have the discussion on a private thread, please let me know, and we can do this on this forum.

A post was split to a new topic: Problem scanning temporary files generated by third-party app

@Yevhen_Novytskyi Are you able to build your .NET 6 solution/project successfully?

I had to update vmImage to ‘windows-2022’ and install .NET 6 SDK for the solution to build successfully in Azure DevOps, see complete yaml file for your reference, hopefully it helps you.

trigger: none

  vmImage: 'windows-2022'

  solutionName: 'MySolution'
  solution: '$(solutionName).sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'


# Add this Command to Include the .NET 6 SDK
- task: UseDotNet@2
  displayName: Use .NET 6.0
    packageType: 'sdk'
    version: '6.0.x'

# Add a Command To List the Current .NET SDKs (Sanity Check)
- task: CmdLine@2
    script: 'dotnet --list-sdks'

- task: NuGetToolInstaller@1

- task: NuGetCommand@2
    restoreSolution: '$(solution)'

- task: SonarCloudPrepare@1
    SonarCloud: 'SonarCloud'
    organization: 'MyOrg'
    scannerMode: 'MSBuild'
    projectKey: 'MyProjectKey'
    projectName: 'MyProjectName'

- task: VSBuild@1
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: SonarCloudAnalyze@1

- task: SonarCloudPublish@1
    pollingTimeoutSec: '300'
1 Like

This topic was automatically closed after 53 days. New replies are no longer allowed.