xcopy returning "file not found" error when run from LabDefaultTemplate.11.xaml Build Definition


  • I am running a build definition using the LabDefaultTemplate.11.xaml.  In Visual Studio 2012, on the 'Process' page for the build definition, clicking on the ellipse for 'Lab Process Settings' opens the 'Lab Workflow Parameters'.  

    Inside the 'Lab Workflow Parameters', the 'Deploy' section, I have an xcopy command that copies a directory from a server location to my test agent machine.  Here is the structure of my xcopy command:

    cmd /c xcopy \\server\folder\folder\folder_ToCopy c:\TAFolderToCopyTo /i/e/y

    I attempt to run the build def and I get the following 2 errors:

    File not found - folder_ToCopy
    Exception Message: Team Foundation Server could not complete the deployment task for machine 'Test Agent 2012', script 'cmd' and arguments '/c xcopy \\server\folder\folder\folderToCopy c:\TAFolderToCopyTo /i/e/y'. (type LabDeploymentProcessException)
    Exception Stack Trace: 
    Server stack trace:    
    at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.RunCommand(AsyncState state)   
    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)   
    at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
    Exception rethrown at [0]:    
    at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)   
    at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)   
    at System.Action`1.EndInvoke(IAsyncResult result)   
    at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)   
    at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

    First thing first, "folder_ToCopy" is not a file, it is a folder.  I want to copy everything from this folder to the Test Agent.  

    If I access the Test Agent through the SCVMM Admin Console, I can execute the xcopy from a command prompt and it works just fine.  But when it is attempted through my build definition, it says file not found.  

    If I try the xcopy command with quotations, same result as above, file not found.  There are no spaces in the folder names, but there is the one underscore.  

    cmd /c xcopy "\\server\folder\folder\folder_ToCopy" "c:\TAFolderToCopyTo" /i/e/y

    I have tried an additional backslash at the end of the source:

    cmd /c xcopy \\server\folder\folder\folder_ToCopy\ c:\TAFolderToCopyTo /i/e/y

    Then I get:

    Invalid Path

    I have tried an additional backslash and *.* at the end of the source:

    cmd /c xcopy \\server\folder\folder\folder_ToCopy\*.* c:\TAFolderToCopyTo /i/e/y

    Then I get:

    File not found - *.*

    The main point is, I have used the initial command 

    cmd /c xcopy \\server\folder\folder\folder_ToCopy c:\TAFolderToCopyTo /i/e/y

    in Visual Studio/TFS 2010 and it used to work (we have since moved to VS/TFS 2012).  I can access the Test Agent machine where I want the command performed and I can run it manually with success (I am accessing the Test Agent in the state the build def leaves it).  

    What is going on?  Am I missing something?

    Saturday, July 20, 2013 5:11 PM


All replies