Naeem Sarfraz

Blogging about Enterprise Architecture, ALM, DevOps & happy times coding in .Net

Release Management 2015: Copying Failed for Robocopy, Component Name Must Match Artifact Name

Overnight we upgraded our on-premise TFS 2015 installation applying Update 3 and this morning I came in to find all our overnight builds failed. Our overnight CI builds, trigger a release in Release Management deploying the latest version of our applications to our dev environment. The problem lay with the Release Management upgrade (Release Management Client for Visual Studio 2015 Update 3).

Release Management reported the following error.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: Deployment started on
target machine...

System.AggregateException: Failed to execute the powershell script. Consult the logs below for
details of the error.
Copying failed. Consult the robocopy logs for more details. ---> System.Management.Automation.RuntimeException:
Copying failed. Consult the robocopy logs for more details. ---> System.Management.Automation.RuntimeException:
Copying failed. Consult the robocopy logs for more details.

2016/07/01 05:03:53 ERROR 2 (0x00000002) Accessing Source Directory \\SERVER\Builds\APPLICATION\1683\Web\Web\
The system cannot find the file specified.

Back to Basics

We have a convention for our TFS builds where using the Publish Artifact Task we’ll organise the contents of the build Artifacts in folders: Web, SQL or App.


Each folder in the TFS Build Artifacts will have a one-to-one mapping to a Release Management component similar to this.


The Path to package normally points to the root of the TFS Build Artifacts folder and we add the word Web so that the component will look for the deployable bits in this folder. This is the only bit I could link back to the error as I saw robocopy was attempting to copy from a folder path that ended with ..\Web\Web. I quickly setup a new component and played around to come across this error.

ERROR: 0 artifact(s) found corresponding to the name 'vNext-Deploy-DEBUG' for BuildId: 1693.
Rename the component such that it matches uniquely with any of the available artifacts of the
build : SQL, Web.


Aha. The last error pointed to the fact that your published artifact (top level folders in your TFS Build Artifacts) must match the name of the component defined in Release Management. In fact I found that it doesn’t have to match the name exactly but the component should contain the name of the artifact. A typical example of the name we use is vNext-DeploySalesApp-WebApp. 

The word Web in the Path to package field would explain why it tried to copy files from ..\Web\Web. Now this box cannot be left empty so we replaced it with .\ and normal service is resumed.

P.S. Very soon we’ll be glad to see the back of Release Management in its WPF client form and move all our releases to the new version which runs out of the TFS site. Can’t wait.

blog comments powered by Disqus