Error copying files from successful build using command line or artifact

Hi all,

I have built a new server with TeamCity v9.0. I am having difficulty trying to copy the build output to a mapped network drive

X:
.

My build steps are as follows:
  1. Get latest version from TFS online.
  2. Build using MSBuild
  3. Run NUnit tests
  4. Copy two folders (Web and ServiceLayer) to a mapped network drive
    X:

Attempted but can not get working:

  1. Created a final build step with the following
    Command Line
    script:

xcopy %system.teamcity.build.workingDir%\ServiceLayer\ D:\ServiceLayer\ /S /Y
xcopy %system.teamcity.build.workingDir%\Web\ D:\Web\ /S /Y

Error:

Step 4/5: Copy build output to web and api on staging (Command Line)
teamcity[buildStatisticValue key='buildStageDuration:firstStepPreparation' value='70.0']
teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_8' value='0.0'] Starting:
D:\TeamCity\buildAgent\temp\agentTmp\custom_script9113406165823545108.cmd
in directory: D:\TeamCity\buildAgent\work\3b1161c630069aad 0 File(s)
copied Invalid path Process exited with code 4
teamcity[buildStatisticValue key='buildStageDuration:buildStepRUNNER_8' value='194.0'] Step Copy
build output to web and api on staging (Command Line) failed

  1. Created an artifact path

    ServiceLayer => d:\Temp\x.zip

Error:


Failed to publish artifacts: Failed to upload artifact, due to error:
java.io.IOException: Failed to create directory:
"C:\ProgramData\JetBrains\TeamCity\system\artifacts\ChannelOptimiser40\CO40 Build Config\224\d:\Temp"

Question
Can someone please tell me how I can copy my

ServiceLayer
and
Web
folders to another directory when the build completes?
4 comments
Comment actions Permalink

Please check that the user that TC agent is running under has an access to the required environment, such as mapped drive, etc.

0
Comment actions Permalink

Hi Sergey,

I am running TeamCity from a Microsoft Windows Server 2012, so would the following steps be correct:

  1. Change the Windows Service (TeamCity Build Agent)
  2. Use the Administrator account in "Log On" properties window of that service.
  3. Restart the TeamCity Build Agent Service



Thanks in advance

0
Comment actions Permalink

As far as I remember, mapped drive is only valid within user session. I think you need to create a persistent mapping, as suggested here: http://stackoverflow.com/questions/182750/map-a-network-drive-to-be-used-by-a-service. Or if you map drive to folder, there is another (but similar) procedure.

0
Comment actions Permalink

Thanks for the help Sergey.

I used the UNC path and changed the account that runs the Windows Service.

The files are now being copied to the directory.

0

Please sign in to leave a comment.