0

I'm new to Team Foundation Build. I've set the post-build events of all my C# projects in Visual Studio to copy the binaries to a physical directory. The command line in each project is:

xcopy "$(TargetDir)*.*" "$(SolutionDir)..\TempOutput\" /Y

The post-build events are fired and the files are copied when I build the solution in Visual Studio. But when building using TFS Build Definition, the events are not fired. Is there anything I need to set separately in my Build Definition to trigger all the projects' post-build events?

I have this in my TFSBuild.proj but still does not work:

<PropertyGroup>
   <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
mark uy
  • 521
  • 1
  • 6
  • 17
  • Which kind of TFS build are you using, XAML build or the new vNext build? – PatrickLu-MSFT Jun 12 '18 at 07:28
  • I'm using XAML Build Definitions. The BuildLog.txt entries state that the projects are copied to a separate src folder (as per Source Settings) and they are built from there. So I guess it is really not compiling the VS solution I have in TFS, but the one copied to src. – mark uy Jun 12 '18 at 07:41
  • Can you make sure the post-build event is not triggered? You can change the command line to `echo This is test command !`, so that you could check the build log directly to know if the build event is triggered. – Leo Liu Jun 13 '18 at 08:43

1 Answers1

0

To narrow down if the issue related to TFS build definition. You should manually remote to the build agent and run msbuild command to trigger the build instead of through TFS server.

Since you are using XAML build, take a look at below:

Team Build use a different directory layouts from Visual Studio builds. All Binaries go in a single folder for any project built, so references are automatically solved and it is easy to copy the DLL to the final Drop folder.

You should use $(OutDir) MSBuild variable to properly reference the binaries directory in VS and TFS builds. See Is there a single MSBuild and TFSBuild variable that will point to where the binaries are? for some details.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62