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:
- Get latest version from TFS online.
- Build using MSBuild
- Run NUnit tests
- Copy two folders (Web and ServiceLayer) to a mapped network drive
X:
Attempted but can not get working:
- 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
-
Created an artifact path
ServiceLayer => d:\Temp\x.zip
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
ServiceLayerand
Webfolders to another directory when the build completes?
Please sign in to leave a comment.
Please check that the user that TC agent is running under has an access to the required environment, such as mapped drive, etc.
Hi Sergey,
I am running TeamCity from a Microsoft Windows Server 2012, so would the following steps be correct:
Thanks in advance
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.
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.