views:

95

answers:

3

I have a number of projects which I have outputting to a central repository of DLLs in my development environment. This is achieved by adding an XCopy command into the Post-build event command line of the project.

XCOPY $(TargetDir)$(TargetFileName) C:\DEV\library /I /R /Y

I want this to happen in dev mode but when on the TeamCity server I want to avoid the script from being executed. What is the best way of doing this? I am going to search through Google and the documentation but was hoping that others have used TeamCity in a similar way and could advise how it is achieved.

Thanks.

EDIT:

The XCopy is supposed to copy the dll's into a central folder (C:\DEV\library) that the peripheral projects that are dependant on them can access. I have in fact removed the xcopy from the projects because I felt it was more of a hack than a help to use it. Felt like I was forcing a square peg into a round hole.

+1  A: 

You could replace “xcopy” with your own program, say myXCopy
myXCopy could check an environmental variable to decide if it should do the copy.
You can then control when this environmental variable gets set.

Or

Write your own MsBuild task to do the copy.
Hook your task into the end of the standard compile task
Make teamcity pass in a MsBuild variable that your custom task checks

Ian Ringrose
Thanks Ian, I will do a test and let you know how I get on.
Monkieboy
+3  A: 

You could define an Environment Variable in your build configuration or in your build agent config and trigger the copy command only if the variable is not set like it is described here: Suppressing Post-build Events

Noffls