Multiple Project Deployment with Azure DevOps

In this article I will demonstrate how to create multiple builds and releases for a single Visual Studio solution that contains multiple projects.

I want to create a separate build and release pipeline for each project.

The repository that I use for this article can be found at , it is composed of a single solution, SampleApp, containing three projects, SampleWebApp, a .NET Core Web App, SampleWebApi, a .NET Core Web Api and SampleFuncApp, a .NET Core Azure Function.

I named my project SampleApp with a single repository.

Navigate to Pipelines, click New and then New build pipeline.

Click Use the classic editor.

By default, the first repository will be selected for you, just click Continue.

In the search box type Core.

Select ASP.NET Core and then click Apply.

In a future article I will show how to do this YAML, but as of this time, the YAML

Since we only want to work with a single project, we need to provide the directory to our project, along with any test projects.

Type SampleWebApp/*.csproj for Project(s) to restore and build.

Type SampleWebAppTests/*.csproj for Project(s) to test.

I only want the build to kick off if some of the files actually changed in the SampleWebApp project.

To do this, we will make use of the Path Filters properties in the Triggers settings for the build.

Check Enable continuous integration.

Under Branch Filters, click Add and add the master branch. Anytime there is a commit to the master branch a build will start.

Under Path filters, we need to specify the paths to look for file changes, you will want to include /SampleWebApp and /SampleWebAppTests. If you shared code with either of these projects you would want to be sure to include those project paths.

We are now ready to kick-off our first build.

Click Save & queue and then Save & queue.

When prompted to Save build pipeline and queue, click Save & queue.

Assuming everything was setup correctly, our first build is created.

You can get to the build quickly by clicking the build number located in the green information bar.

Now you can sit back and watch the build do it’s stuff.

Wash, rinse and repeat for the SampleWebApi and SampleFuncApp projects.

17 Replies to “Multiple Project Deployment with Azure DevOps”

  1. Thanks for your post.

    If you have a shared project used by the 3 other projects. There aren’t a problem if there are a change only on is this shared project?

    1. It all depends what you put in the path filters, if you want your other three projects to trigger off of changes to the shared project, add the shared project to the path filter.

  2. Thanks for this is great post, it guided me with the question about deploying multiple projects with Azure Devops. The only missing detail is to uncheck the “Publish Web Projects” option in the Publish Task. I had a lot of problems until the moment I uncheck that option . I don’t know if it worked for you leaving that option checked.

    Anyways, thanks a lot of the post.

  3. We have a .Net solution with multiple C# projects in it. MVC, MVC web api, class libraries, test projects etc.

    Do we need to create separate yaml for every project or we can have single yaml for multiple CSProj?

    1. I would imagine you could create a single YAML file, as the YAML file just defines tasks to run, not sure why you could not run multiple build and publish tasks. The thing I would question though is the maintenance of the YAML files, I think that concepts like encapsulation and single responsibility (build per file) should apply to configuration files.

  4. Matt: I am working on ASP.NET MVC Application and the basic ASP.NET template does not have project selection option when creating build pipeline. My solution has multiple projects, that I need to build each of them separately and deploy them to different servers. Do you have any suggestions?. Thanks in advance.

    1. Hi @vasavij,

      I think if you build them separately, you will generate different artifacts. I have a solution with three projects that all build on the appropriate trigger and generate their artifacts, I then have a release pipelines set up for each build/artifact.

      Is that what you are trying to do?

  5. Hi Matt, i have multiple projects in a solution(which is the master branch). Every time when a new change/Checkin happens to any of the project in Master branch, all projects are built again. Is there a way to build only projects which are changed in a single YAML file?

  6. I’ve got more than one test project in the solution. My inputs for the ‘test’ command are specifying projects as ‘**/*.Test.csproj’
    When test and coverage tasks are run the ‘publish code coverage results’ task is overwriting the previous results.
    Is there a way to specify project path so the consequent runs would not overwrite each other?

Leave a Reply

Your email address will not be published.