Monorepo projects
Adding analysis to your Azure build pipeline for a monorepo.
Typical YAML file example for a monorepo analysis
# Template pipeline that build 2 distinct .NET projects, living in 2 separate folders in the repo. We are analyzing them on SonarQube Server, each targets a specific SonarQube Server project.
trigger:
- main # or the name of the main branch
pool:
vmImage: windows-latest
steps:
- task: VisualStudioTestPlatformInstaller@1
inputs:
packageFeedSelector: 'nugetOrg'
versionSelector: 'latestPreRelease'
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '6.x'
includePreviewVersions: true
- task: NuGetToolInstaller@1
inputs:
versionSpec: '5.9.0'
checkLatest: true
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: '**/*.sln'
feedsToUse: 'select'
- task: SonarQubePrepare@7
inputs:
SonarQube: '<YourSonarqubeServerEndpoint>'
scannerMode: 'dotnet'
projectKey: 'myRepo_myProject1'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: 'myproject1/solution.sln'
arguments: '/nr:false' // this flag is important to avoid DLL lock for the 2nd build/analysis
- task: SonarQubeAnalyze@7
- task: SonarQubePrepare@7
inputs:
SonarQube: '<YourSonarqubeServerEndpoint>'
scannerMode: 'dotnet'
projectKey: 'myRepo_myProject2'
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: 'myProject2/solution.sln'
arguments: '/nr:false'
- task: SonarQubeAnalyze@7Last updated
Was this helpful?

