1

I would like to create a Build Definition inside TFS 2012 Express which will simply copy all files within my project source tree to another folder on my drive. Just to underline - I do not want the build output to go to another directory - I want the source files themselves to. The reason for this is I have IIS pointed at a specific folder, and I want the build to copy the latest asp and aspx files to the IIS hosted folder.

I am not sure of the intricacies of doing this, I did find : http://toadcode.blogspot.co.uk/2008/06/copy-multiple-files-via-tfs-build.html articles like this but I simply need a more direct list of what I need to do from somebody who understands this area.

Basically - when the build is queued, all I want is to copy my project source files to another directory :). I think this can be done by editing some Build.xml file...but when making a build definition I dont seem to be given the freedom to do what I would like to!

I think what I am looking for to alter my DefaultTemplate.11.1.xaml file to alter the build process which will let me run this / or a batch file after the build process completes?

My TFS build process edit screen looks like this: tfs

RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130
  • Not quite and answer, but here is a blank template you could start from: http://blogs.msdn.com/b/granth/archive/2012/01/03/tfs-empty-process-template.aspx – DaveShaw Jul 03 '14 at 21:12
  • This looks like it could be useful but I do not have the experience or desire to start from a blank template because the template I am using : DefaultTemplate11 seems to be a good place to start - i simply want to edit it to contain my extra requirements – RenegadeAndy Jul 03 '14 at 21:28
  • Do you just want to copy files in addition to the compilation and build output? – DaveShaw Jul 03 '14 at 21:38
  • Yeah! Pretty much Dave. – RenegadeAndy Jul 03 '14 at 22:06

3 Answers3

2

Using this post as a guide on how to start editing TFS Build Templates (or the Wrox TFS 2012 book), you need to make the following changes:

  • Locate the Copy to Drop Folder Activity:

Copy to Drop Location

  • Drag in a "CopyDirectory" activity under the "Drop Files to Drop Location" (from the Toolbox under Team Foundation Build Activities):

Copy Directory

  • Goto the Properties Window for the new Activity and set Source and Destination as follows:
    • Destination: Path.Combine(BuildDetail.DropLocation, "MyOutputFolder")
    • Source: Path.Combine(SourcesDirectory, "MyFileFolder")

You may need to repeat this if you don't have all your files in one folder.

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • This looks great but when i go open the xaml it says cannot view on X64 or ARM processors...which is fantastic!! So I will need to know the specific markup for my additions...can you help here? – RenegadeAndy Jul 04 '14 at 13:55
  • I edit my XAML in Windows 7 x64 using VS2012 (to match TFS 2012). Do you have it in a Project with all the references added (as per Ewald's guide)? – DaveShaw Jul 04 '14 at 15:14
  • I dont see that in his guide Dave!? – RenegadeAndy Jul 04 '14 at 16:20
  • I have added a new post for this problem : http://stackoverflow.com/questions/24578232/team-foundation-server-2012-express-buildtemplate-process-xaml-files-not-opening – RenegadeAndy Jul 04 '14 at 16:33
1

I actually put something together for TFS2010 and 2013 (not 2012, unfortunately) a few weeks ago that does exactly that. Basically, anything in the workspace you define for your build just gets shoved over to the drop location.

Here's a link to the blog post where you can download them:

http://www.incyclesoftware.com/2014/06/deploying-uncompiled-resources-release-management/

For the record, I strongly recommend against using a build process template to deploy software. Don't try to overextend the build... its job is taking stuff from source control and compiling/packaging it for deployment. Use a real release management solution to actually handle deploying software.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
  • This is very close - but neither of those build definitions seem to be compatible with TFS 2012 Express. And they are quite complicated to alter it would seem. – RenegadeAndy Jul 03 '14 at 22:07
  • Above link breaks. Go here: http://blogs.incyclesoftware.com/2014/06/deploying-uncompiled-resources-release-management/ – Sangam Uprety Aug 31 '17 at 09:04
1

Add a bat file to your source folder. within the batch file add an xcopy %1*.* TargetLocation. Add an invoke process activity to your workflow, somewhere near the end. call the bat file and pass it the SourcesDirectory.

Just TFS
  • 4,697
  • 1
  • 18
  • 22
  • Please see the update to the question - i have included all I see on the TFS build process. – RenegadeAndy Jul 04 '14 at 09:10
  • As you state in your question, add an invoke process activity to your default template. create a copy of the template first (always retain an original version!). In the template work flow you can add an invoke process from the tool box. you should be able to find the template under source control, under BuildProcessTemplates – Just TFS Jul 04 '14 at 11:14