views:

355

answers:

4

Hello,

I want to create a post build script that moves files from the build directory to a remote (UNC) file share.

This line:

xcopy "C:\TeamCityBuild\project\WebSite\*" "\\192.168.1.1\WebSite\" /C /R /Y /E

Works fine when it is ran in a DOS-window but when TeamCitys buildrunner sln2008 tries to run it it fails with the message "Invalid drive specification"

I have shared the folder with full rights for 'Everyone' on the remote server.

Any ideas?

+3  A: 

Just a guess. Not quite sure if it solves your problem. We had a similar problem using CruiseControl and deploying our application to remote JBoss server. We've added

net use \\192.168.1.1\Website ...

before each copy. So that it 'mounts' the remote share before trying to access it. Note: you probably need to specify the username and password for the command (consult the command line for details).

The 'net use' seems needed even if you run the automated job as the same user you log on manually. These two kinds of sessions seem not to share remote shares information.

Grzegorz Oledzki
After a few attempts this works great! Thank you!
Zooking
A: 

I've never used TeamCity Buildrunner sln2008, but if it runs as a service, then it is probably running under the "Local System" account, which doesn't have network access. Change the service properties (under the "Log On" tab) so that the service logs on as a user with permissions to that network share.

Templar
Nope, tried this but it didn't work.
Zooking
A: 

I don't beleave it works because the agent is running as a system service so it has limited network access (I beleave).

Instead of trying to use a post build step to copy the output, I think you should look into using TeamCity's Build Artifact's. That's what we use at my work altho we are new to TeamCity as well. What I don't know is if Build Artifact system will do extactly what you want.

Shane Powell
I couldn't find a way to transfer the Artifacts to a different server over UNC.
Zooking
A: 

You could try nANT

http://nant.sourceforge.net/release/latest/help/tasks/copy.html