0

I have TFS2010 building a project solution, which is a copier. The build is succesful but does nothing, ie. doesn't copy.

How would I get the triggered build to copy the file?

Thanks

I have TFS 2010 and VS professonal 2010

EDIT

Update

Copier is the project being built. I added start copier.exe to the post build and it works when I build it manually, as in going to the build drop down menu and clicking build copier. But when I shedule a TFS build it doesn't start copier.

ELSheepO
  • 305
  • 3
  • 9
  • 26
  • What do you mean by a project solution being a 'copier'? Can you please explain what you are trying to achieve? Is your problem that the build output doesn't get copied into the Drop location? – pantelif Jun 15 '12 at 09:30
  • The output does get put in the Drop folder, thats not the problem. The code I wrote copies a folder and stores it on a server. When the build is done, it hasn't copied the folder. I'm wondering if there is a way for the build start the program, which would do the copy. – ELSheepO Jun 15 '12 at 09:36

2 Answers2

3

If you need the build process to invoke a program you need to edit the TFS Build Process Template.

There are a number of resources on the net for this, a good one is by Ewald Hofman. You can also find details in the TFS 2010 book by Wrox.

Once you are familiar with the Process Template you will need to add an InvokeProcess activity after the activities for the build has completed.

Also, consider adding a If activity and setting an argument so you can control which builds do this and which don't - for example, do your CI builds need this step?

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • I had stumbled across Ewald's page but didn't give it a proper read so am doing that now. Your right I do want to invoke the program after the build, so hopefully the read will be a good one ;) – ELSheepO Jun 15 '12 at 10:52
  • It is, I have heavily customised my build process templates at work based on Ewald's posts and that book. – DaveShaw Jun 15 '12 at 10:54
  • I've tried following the steps, but got as far as 2/3 and I've been having problems with the .xaml as it won't let me save it. – ELSheepO Jun 19 '12 at 13:38
1

I can't edit our build definition templates because they are company wide.

So I change the project file with extra post build steps.

Just add a step in the post buildstep of the project that contains the copier. You can call your output executable.

I do it for distributing my TFS builds to different release folders

Add this step:

"$(TargetPath)" to your project file.

Schwarzie2478
  • 2,186
  • 26
  • 30
  • How do you mean post build? The project is the copier. – ELSheepO Jun 15 '12 at 09:59
  • Your project generates an executable that has to be executed right after the build, right? The post build step is executed right after the compilation of the project of the copier if you add the presented option there. – Schwarzie2478 Jun 15 '12 at 10:05
  • And where is the post build step? I can't find it in the edit build defintions. Do you mean to add the `$(TargetPath)` into the workspace tab? – ELSheepO Jun 15 '12 at 10:19
  • With VB Projects there is a Build Events Tab if you open Project Settings – Schwarzie2478 Jun 15 '12 at 10:52
  • You don't add it to the build definition, you add it to the project itself... I didn't read your question entirely the first time! – Schwarzie2478 Jun 15 '12 at 10:56
  • Oh I see it now. And do I just add a C# `Process.Start(copier)` line in there? – ELSheepO Jun 15 '12 at 11:06
  • No the post step is like a batch file with special parameters. You can't add code there, you can only execute stuff. So maybe you can make a small project which calls Process.Start(copier) and let that be the last solution that is built in your build definition. The post build step of that project is where you want to add the extra line. – Schwarzie2478 Jun 15 '12 at 11:23
  • so it should be `start c:\doc\users\copier.exe` ? or do i need to add that small project? – ELSheepO Jun 15 '12 at 11:37
  • What has to run exactly? Is copier.exe an external tools or something you build. If you build it, you can add a post build step to the project of copier.exe. If it's external, you just add Path\copier.exe to the post build step of the project to be built by the build definition. I don't think I can make it any clearer then this :-( – Schwarzie2478 Jun 15 '12 at 12:10
  • Copier is the project being built. I added `start copier.exe` to the post build and it works when I build it manually, as in going to the build drop down menu and clicking build copier. But when I shedule a TFS build it doesn't start copier. – ELSheepO Jun 15 '12 at 12:37
  • excellent progress, I suspect the final fix is replace "start copier.exe" with $(TargetPath) ( this will translate to the correct path on the build machine) – Schwarzie2478 Jun 15 '12 at 12:47
  • Done that, doesn't seem to have worked. I schuled the build for 14:00 and it built but didn't do the post build steps. :( – ELSheepO Jun 15 '12 at 13:06
  • Do you mean add just `$(TargetPath)` or should it be `start $(TargetPath)/copier.exe`? – ELSheepO Jun 19 '12 at 13:32