1
votes

I've been working to build a custom build task which reads xml files, and combines the contents into one xml file and writes it out to the output directory of the build, I use ${OutputPath) to get this.

The build task works fine when locally built, the xml file appears as expected.

However, I've added the new solution, and thus the csproj file with the AfterCompile target overridden (I've also tried AfterBuild) with the specific custom task needed to our main TFS build project. The TFS build fails now because my custom task is throwing an exception:

The "QBBuildTask" task failed unexpectedly. System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:*path to TFS build output for this solution*\86\Release\QueryBuilder.xml'.

note the ** are my addition to reduce the size of the error for SO.

It looks like the release folder isn't existing when my task tries to write to it.

My question is, should I get the Task to create the directory if it does not exist, or am I using the wrong output path variable for TFSBuild?

Seems a bit odd it works correctly locally, even if I delete the output folders before trying to build.

Anyone got any ideas please?

Marlon

1

1 Answers

0
votes

Turns out OutputPath is not correct when using TFSBuild, so my xml was being put somewhere random, have now used a conditional property using the correct TFSBuild property 'TeamBuildOutDir'.

<PropertyGroup>
  <OutputPathCond Condition=" '$(TeamBuildOutDir)'=='' ">$(OutputPath)</OutputPathCond>
  <OutputPathCond Condition=" '$(TeamBuildOutDir)'!='' ">$(TeamBuildOutDir)</OutputPathCond>
</PropertyGroup>

This now means it works locally and on the server.

Thought I'd leave this up in case anyone has a similar issue.