0

When I tried to call command-line to get latest update for my TFS mapped folder

TF get /recursive

The call complete successfully from the run window of Windows 7.

However, when I put the call into a .bat file and run it via InvokeProcess within a build definition (guide to do that), it failed.

The message is as below.

Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'

What happens? How can I get around with that?

7
  • 3
    Did you sepcify the workingdirectory of the InvokeProcess activity to the Sources directory of the Build Definition? Which version of TFS? Commented Dec 23, 2013 at 12:28
  • No I didn't specify the working directory. I call CD /D in my batch script. I'll try to set the working folder then. TFS version is 2012 Commented Dec 24, 2013 at 3:21
  • Setting the Working Directory in the properties of InvokeProcess activity but the error stay the same. Commented Dec 24, 2013 at 6:25
  • are some other variables set (Arguments)? Commented Dec 24, 2013 at 8:18
  • Where did you cd /d to? Can you confirm that the user the build is executing under has a workspace configured for that directory? Commented Dec 24, 2013 at 10:18

2 Answers 2

1

The reason this is happening is because when you run the command locally, the folder you're downloading is mapped to a workspace. When you execute the command in your build, it's running under the build service account, which doesn't have a workspace mapped for the folder you're specifying.

You shouldn't need to use the tf get command as part of your build. When you configure your build, you can specify which folders should be mapped in the workspace on the "Source Settings" tab. The build process will handle making sure the contents of the folders you map in your workspace are present automatically.

Sign up to request clarification or add additional context in comments.

Comments

0

The cause for my issue is that the build agent execute my .bat file under a different Windows account which is something like NTSERVICE; when I run it directly, my TFS login account was used (which was previously remembered in Windows 7 Credential Manager)

So the solution is to put in the login name and password as TF get /login:SomeTFSUsername,SomePassword (see more here)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.