Home > OS >  Is there a way to have an Azure Pipeline only build specific projects in a solution?
Is there a way to have an Azure Pipeline only build specific projects in a solution?

Time:10-12

I have an Azure Pipeline that builds all the projects within a solution, but I want to pick and choose which projects get built or ignored by the pipeline. I think that having a "ToBuildBool" boolean to flag which projects are to be built or not is the way to go. The "ToBuildBool" is set as "true" by default and can be set to "false" manually in the csproj files of the projects I do not want built by the pipeline, but rather to be ignored. Am I on the right track? How do I set the boolean flag in a csproj file?

- task: DotNetCoreCLI@2
  displayName: 'DotNetCore Build'
  inputs:
    command: 'custom' 
    custom: 'build'
    projects: 'MySolution.sln'
    feedsToUse: config
    nugetConfigPath: nuget.config
    arguments: '-c Release -p:ToBuildBool=true'   # set build flag'

CodePudding user response:

You can specify multiple projects to the projects parameter. That's why it's plural, not singular. Refer to the documentation for the DotNetCoreCLI@2 task for examples of supported patterns.

Or you can have multiple sequential invocations of the DotNetCoreCLI@2 task, one per project you'd like to build.

  • Related