.NET Monorepo + Azure DevOps CI Pipeline

Hi All,

I have a monorepo,MyWebApp, with the following structure. It’s a .NET webapp.

Repo:MyWebApp
  MyWebAppDB
    MyWebAppDB.csproj
  PresentationLayer
    PresentationLayer.csproj
  BusinessLayer
    BusinessLayer.csproj
  DataLayer
    DataLayer.csproj
  MyWebApp.sln

I am trying to add a new project to the repo and it will look like this. The new project is built and deployed separately.

Repo:MyWebApp
  MyWebAppDB
    MyWebAppDB.csproj
  PresentationLayer
    PresentationLayer.csproj
  BusinessLayer
    BusinessLayer.csproj
  DataLayer
    DataLayer.csproj
  MyWebApp.sln
  MyAPI
    MyAPI.csproj

Or do have to separate them into a separate folder like this.

Repo:MyWebApp
  MyWebApp
    MyWebAppDB
      MyWebAppDB.csproj
    PresentationLayer
      PresentationLayer.csproj
    BusinessLayer
      BusinessLayer.csproj
    DataLayer
      DataLayer.csproj
    MyWebApp.sln
  MyAPI
    MyAPI.csproj

I have created a separate project key for the new project. Does anyone have such similar setup? I am not sure whether it is supported or not.

Cheers,
Gordon

Hey there,

I think that from a .NET perspective, both are probably fine. Up to you to decide which is cleaner.

As far as SonarQube is concerned, if you don’t want to include MyApi in your MyWebApp.sln (and I assume, in this answer, they are completely separate build-wise), you have two supported options:

  1. Separate Projects
dotnet sonarscanner begin /k:project1
dotnet build MyWebApp.sln
dotnet sonarscanner end

dotnet sonarscanner begin /k:project2
dotnet build MyAPI/MyAPI.csproj
dotnet sonarscanner end
  1. Single Project (Combined Build)
dotnet sonarscanner begin /k:project1
dotnet build MyWebApp.sln
dotnet build MyAPI/MyAPI.csproj
dotnet sonarscanner end