Configuring destop builds for building specific solutions in Team Build

 

Scenario

I have set up a Team Build Type which builds an entire system consisting of multiple solutions. I want an easy way for developers to be able to invoke builds on there dev machines (for only the solutions they are working on) using Team Build. We do not want developers to build the entire system (all solutions) as this will result in lot of time wastage. Additionally we do not want to create a seperate Team Build Type for each developer for supporting the desktop scneario for scalability and mantainability issues. Is it possible?

Yes, it is possible. Developers don’t need to define new build type customize for there needs. By doing simple customization in tfsbuild.proj file and passing desktop properties scenario can be easily enabled.

For example we are building two solutions (App1.sln and App2.sln) in team build but I want to build only App1.sln solution for my dev box (for desktop build). However my changes will not affect the non desktop scenarios.

The changes are –

In tfsbuild.proj

Change lines –

<ItemGroup>

    <!-- List of solutions to build for

  - desktop scenarios

  - non desktop scenarios

     -->

    <SolutionToBuild Include="$(SolutionRoot)\App1\App1.sln" />

    <SolutionToBuild Include="$(SolutionRoot)\App2\App2.sln" />

</ItemGroup>

To lines -

<ItemGroup>

    <!-- List of solutions to build for non desktop scenarios only. -->

    <SolutionToBuild

      Condition=" '$(IsDesktopBuild)'!='true'"

      Include="$(SolutionRoot)\App2\App2.sln" />

    <!-- List of solutions to build for

       - non desktop scenarios

       - desktop scenario with ComputerNameParameter set to name of

         current computer name

    -->

    <SolutionToBuild

Include="$(SolutionRoot)\App1\App1.sln"

Condition=" '$(IsDesktopBuild)'!='true' OR

            '$(COMPUTERNAME)'=='$(ComputerNameParameter)'" />

  </ItemGroup>

Execution after change

1. msbuild TFSBuild.proj – no project will be build for desktop build

2. msbuild TFSBuild.proj /p:ComputerNameParameter=<MyComputerName>

Only App1.sln project will be build for the desktop scenario. It assumes that your build machine for desktop build is represented by <MyComputerName> variable.