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
https://dev.azure.com/maruma/SampleApp , 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.

24 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. Asp.net MVC, asp.net 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. I really appreciate you took the time to write this. I was looking for this all morning! Keep up the good work! 🙂

  5. 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?

      1. Hi Matt,
        Thanks for taking time to write this piece. I think this is going to be very useful for me. I want to experiment with publishing to different servers. Is the sample app you linked to above available? I tried to follow the link, logged in with my Microsoft account but got a 401. Is the SampleApp publicly available?
        Thanks.

  6. 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?

  7. 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?

  8. Hi Matt

    I am fairly new to the whole idea of DevOps and Build Pipeline with Continuous Integration. I have a solution with 2 azure functions that I need to build and deploy independently. While search for solution and ideas on building pipelines with a single solution and multiple projects, I found your post. I helped me greatly and I got the CI to work as expected. My next step is to build release pipeline with multiple stages such as Dev, UAT, Production. I am still waiting for the infrastructure team to setup my permissions correctly so that I can start building the release for each of the stage mentioned above. I just like to say thank you for the post.

    Regards
    Paul

  9. Hi, thanks for the post. I know you mentioned at the end to wash, rinse, and repeat for your other projects – wanted to get clarification. I have a solution with two sites, one on NET Core and the other is MVC. I want to build the projects in a single build pipeline, essentially having steps for MVC and Core. I tried several ways of doing this but no luck yet. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *