Question

I try to set up a MSBuild-project that will copy the file(s) that are being checked in into TFS (2010) to a specific directory at the Build-server (or share). I have the Build Definition as a Continuous Integration, but how can I get to the specifics files I am checking in, and copy only those to the directory?

(The best would be If only inchecked *.sql-files should be copied, but if all files I am checking in goes there It's ok. I can manage it from there.)

Does anybody know how to only copy the chosen files?

Was it helpful?

Solution

By default there is no way to do this. There is no standard out-of-the-box build activity that does this for you.

What you can do is to create a small Custom Build Activity that checks which ChangeSets are associated to your build. Then use teh VersionControlServer class int he TFS Client Object Model (specifically the DownloadFile method) to download the changed files in these changesets and save them to wherever you want. Remember to pass in the VersionSpec you can use the c##### changeset number format.

If you just want the files that are in the Builds workspace you need to do a few more things (checking the Workspace Mapping of the Build Definition).

See also:

The GetChangeSet activity in the TFS Build Extensions should provide a great starting point.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top