Azure yaml for C# mono-repo

GitHub & Azure DevOps, C#

I keep getting the following error on the analysis step

##[error]ERROR: Error during SonarScanner execution
##[error]ERROR: You must define the following mandatory properties for ‘Unknown’: sonar.projectKey

Here’s a portion of the yaml scripts

- task: SonarCloudPrepare@1
  displayName: 'Enabling Sonar Cloud ${{variables.project}} ${{variables.Version}}'
    SonarCloud: <TheConnectedService>
    organization: <TheSonarOrganisation>
    scannerMode: CLI
#    projectKey: <Organisation>_<SonarProject>
#    extraProperties: sonar.sources=${{variables.project}} 	Mono repo fiolder?
    cliProjectKey: <Organisation>_<SonarProject>
    cliSources: ${{variables.project}} 				Mono repo fiolder?
    cliProjectVersion: ${{variables.Version}}
    cliProjectName: ${{variables.project}}

- task: SonarCloudAnalyze@1
  displayName: 'Analysis Sonar Cloud ${{variables.project}} ${{variables.Version}}'

- task: SonarCloudPublish@1
  displayName: 'Publish Sonar Cloud ${{variables.project}} ${{variables.Version}}'


Welcome to the community!

According to the docs, you should drop the cli on the front of your properties, so:

    projectKey: <Organisation>_<SonarProject>
    sources: ${{variables.project}} 				Mono repo fiolder?
    projectVersion: ${{variables.Version}}
    projectName: ${{variables.project}}

Also, I note that you’ve said you’re analyzing C#, but you’re using the CLI scanner. You’re going to need to switch.