2

my case , i want to copy from Folder TFS to build drop location when my build succeeded
i am using copy directory activity, in copy activity directory

  1. destination directory ="Build Drop Location"
BuildDetail.DropLocation
  1. source directory ="TFS Floder"

i know that build agent get source code from TFS to its machine on to this path

$(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath)

, so how i want to get this path to use it in copy activity

mohammed sameeh
  • 4,711
  • 3
  • 18
  • 19

1 Answers1

1

There is property in build workflow SourcesDirectory that holds the source folder, if you are not doing anything fancy with sources and definition is based on default it should be what you need.

Its based on following

String.Format("{0}\Sources", BuildDirectory)

The BuildDirectory is retrieved from build process and is the location defined in agent usualy as your linked ($(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath))

drk
  • 865
  • 5
  • 9
  • 1
    BuildDirectory is only accessible in Run on Agent , can not access it from Over All Build Process i tried to make BuildDirectory accessible to Over All Build Process but it is useless – mohammed sameeh Apr 29 '13 at 10:52
  • Well you cannot get the value of agents build directory before it has chance to run, if you need it after its completed you will have to define your own variable in higher scope and assign it value during build agent scope, or move your activity inside agent scope as it depends on its resources – drk Apr 29 '13 at 11:11
  • 1
    1- add myvaribale with scoop Over All Build Process Sequence 2- add Assign Task with Scoop Run On Agent Sequece,Contains Variable=BuildDirecotry ,Pre-Last Task in this Scoop 3- add WriteBuildWarning with Scoop Run On Agent , Prints myVariable , Last Task in this Scoop , works well 4- add WiteBuildWarning With Scoop Over All Build Process , Prints myVariable ,Last Task in this Scoop works useless – mohammed sameeh Apr 29 '13 at 11:46
  • Why can't you do the copy inside the Run On Agent? – Dylan Smith Apr 29 '13 at 17:14
  • @DylanSmith,it works well in Run On Agent, but i am surprised why it is not working well in Over All Build Process. – mohammed sameeh Apr 29 '13 at 21:33
  • The compilation and build outputs are generated on the build agent, outside the run on agent activity you don't have access to them. The vast majority of the build tasks should be done on an Agent, that is the way TFS Build was designed. – Dylan Smith Apr 29 '13 at 22:22