Dynamic number of MSBuild tasks

41 Views Asked by At

In CC project config file I have many MSBuild tasks. Each task is used to build one solution.

Problem is that this requires maintenance if this CC config file each time when new project is added to / deleted from repository.

My idea is to pass to the CC dynamic list of solutions that should be build and execute build one by one as it is done now with "static / old fashion" maintenance of config file.

Does anyone prepare already such configuration?

1

There are 1 best solutions below

0
Simon Laing On

Presuming you have something akin to the following:

On disk:

  • ./solution1.sln
  • ./solution2.sln
  • ./solutionN.sln

And a single ccnet project:

  • Msbuild task -> solution1.sln
  • Msbuild task -> solution1.sln
  • Msbuild task -> solutionN.sln

What you are asking for is ccnet to react to what is outside of its environment. This isn't possible, however it would be possible to get another tool to do so.

Possible options:

1. Custom Msbuild project Create a specific msbuild project which finds and invokes msbuild on all solution files it finds. Call msbuild on this project alone. It should be possible to do this with vanilla msbuild, see https://msdn.microsoft.com/en-us/library/z7f65y0d.aspx

2. Batch files Find all files, and for each file execute msbuild. Ensure the output is logged to an XML file (msbuild switch - I believe) and merge in the result in the publishers section. See How to do something to each file in a directory with a batch script

3. Single solution Create a single solution, which contains all the projects from all solutions (1 to N) and call msbuild on this once. This solution file would be need to be updated each time a new project comes along however.