How to Configure TFS 2018 build/release definition, to deploy a particular service out of many in an SOA?

117 Views Asked by At

I have a "SOA" styled application, with a single solution containing almost 100 individual projects (which are a solution within them, i.e. they can be run independently). I have created a build and release definition in TFS 2018 and everything works perfectly. The issue is if I make changes to a single service (out of 100), and check-in my code, the build definition is triggered which builds the entire application and then the release definition deploys the entire thing(100+) each time. I don't want it. I need it to be specific to the service in which changes are made. Is there any way to do it? Creating multiple build/release definition which is tied to the specific path of each service should solve it but I don't want to go down that road, because I will end up creating 100's of definitions. Is there any other way to do it?

This is for a .Net application, hosted in TFS 2018 (On-premise).

The solution structure is as below:

AllWCFService.sln
  |_Service1.csproj 
  |_Service2.csproj
  |..
  |..
  |_Service100.csproj

Each Service can also be run and hosted independently.

This is my first question here. I apologize for any confusion.

1

There are 1 best solutions below

0
PatrickLu-MSFT On

As you have mentioned, by using Path filters on the Build definition should be the easiest solution.

With the proper path to the project in the Path filter only the proper Builds spin up, and any projects untouched do not trigger a build. Each build has it's own release which then deploys the specified app to it's own destination. As a ugly workaround, you could set up a group each with 5 services which will reduce 100's of definitions to 20's.

Otherwise, you have to customize your build definition/pipeline. Use some scripts to determine or judge which part of your Servicex.csproj changed base on your name.

Then call msbuild with /t option to build a single or multiple projects.

msbuild test.sln /t:project;project2 /p:Configuration="Release" /p:Platform="x86" /p:BuildProjectReferences=false

specify project file of a solution using msbuild

It will only build specified changed project and generated corresponding artifacts. Then add scripts in release to specify path according build generated artifacts to deploy each service.

Hope this helps.