locked
Copy build output to drop location actually cuts but not copies binaries to the drop location RRS feed

  • Question

  • Hi,

    I have a TFS build definition created on TFS 2013. The option to copy the binaries to drop location is selected in the . But, what I see is that the binaries are moved to the drop location instead of copying. I need the dlls to be present in the bin/debug folder of my project as well.

    I am wondering if there is any option to specify that it should just copy the binaries but not completely move them to the drop location.

    Any help is highly appreciated.

    Regards,

    kvk1985

    Monday, October 19, 2015 7:23 AM

Answers

  • The behind the scenes workings of Team Build 2013 are even different than what you think you're observing.

    In team build, by default, the build output is redirected to a special folder next to your sources, by default Team build will create the following folders for your build:

    Build Definition Root

    • src
    • bin
    • testresults

    Then it instructs MsBuild to redirect the output of each project to "BuildDefinitionRoot\bin", so by default no files are ever stored under your project's bin\debug folder. Team Build does so by overriding the $(OutputPath) or $(OutDir) variables.

    There is an option in Team Build 2013 (it was introduced in that version) called "OutputLocation"

    The default is SingleFolder, which is the same behavior TFS 2010 and 2012 would do. 2013 introduced two new option:

    • PerProject
      Contrary to what the name suggests, this creates a subfolder under "BuildDefinitionRoot\bin" with the name of each solution configured in the build definition. (PerSolution would have been a better name)
    • AsConfigured
      Doesn't tell Team Build to do anything, which will ensure that your binaries end up in the location configured in your project files. The problem is that since the "BuildDefinitionRoot\bin" will remain empty this way, nothing will be copied to your drop location. 

    So when you select Custom, you'll need to include a post-build script (usually a powershell script) or a post build action in your project files which will copy the required files to your binariesdirectory.

    In your scripts you can make use of the "TF_BUILD_BINARIESDIRECTORY" environment vaiable to know where to copy these files to. The following page on MSDN contains an example which shows how to do this.


    My blog: blog.jessehouwing.nl

    • Proposed as answer by John QiaoModerator Tuesday, October 20, 2015 2:53 AM
    • Marked as answer by kvk1985 Wednesday, October 21, 2015 5:20 AM
    Monday, October 19, 2015 5:52 PM

All replies

  • The behind the scenes workings of Team Build 2013 are even different than what you think you're observing.

    In team build, by default, the build output is redirected to a special folder next to your sources, by default Team build will create the following folders for your build:

    Build Definition Root

    • src
    • bin
    • testresults

    Then it instructs MsBuild to redirect the output of each project to "BuildDefinitionRoot\bin", so by default no files are ever stored under your project's bin\debug folder. Team Build does so by overriding the $(OutputPath) or $(OutDir) variables.

    There is an option in Team Build 2013 (it was introduced in that version) called "OutputLocation"

    The default is SingleFolder, which is the same behavior TFS 2010 and 2012 would do. 2013 introduced two new option:

    • PerProject
      Contrary to what the name suggests, this creates a subfolder under "BuildDefinitionRoot\bin" with the name of each solution configured in the build definition. (PerSolution would have been a better name)
    • AsConfigured
      Doesn't tell Team Build to do anything, which will ensure that your binaries end up in the location configured in your project files. The problem is that since the "BuildDefinitionRoot\bin" will remain empty this way, nothing will be copied to your drop location. 

    So when you select Custom, you'll need to include a post-build script (usually a powershell script) or a post build action in your project files which will copy the required files to your binariesdirectory.

    In your scripts you can make use of the "TF_BUILD_BINARIESDIRECTORY" environment vaiable to know where to copy these files to. The following page on MSDN contains an example which shows how to do this.


    My blog: blog.jessehouwing.nl

    • Proposed as answer by John QiaoModerator Tuesday, October 20, 2015 2:53 AM
    • Marked as answer by kvk1985 Wednesday, October 21, 2015 5:20 AM
    Monday, October 19, 2015 5:52 PM
  • Hi Jesse,

    Thanks for the insight into OutputLocation and "Copy build output to drop location". My issue is addressed using a combination of "AsConfigured" option, "Copy build output to drop location" option and CopyDirectory activity.

    Regards,

    kvk1985

    Wednesday, October 21, 2015 5:25 AM