Monday, 26 September 2011

Team Build, fixing the "Unable to determine the workspace" error

When running the Team Build on Team Foundation Server 2008 you may get the following error in your build log (replaced file paths with dummy PATHTOMYFILE, etc):


Error:

Using "Exec" task from assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Exec"
  "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\..\tf.exe" get /force /noprompt "PATHTOMYFILE"
  Unable to determine the workspace.
PATHTOBUILDFILE\BuildType\TFSBuild.proj(60,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\..\tf.exe" get /force /noprompt "PATHTOMYFILE"" exited with code 100.
Done executing task "Exec" -- FAILED.


Solution:
A) make sure you have a workspace mapping for your build computer and for the windows account under which team build agent runs
B) Remote desktop to your build server under the build account and run the following from the command line
@echo off

SET TFPATH=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe
echo Listing the workspaces for %USERNAME%
"%TFPATH%" workspaces /s:http://BUILDSERVERNAME:8080 /owner:%USERNAME%


echo Press any key now to refresh workspaces or close the window to exit
pause


"%TFPATH%" workspaces /s:http://BUILDSERVERNAME:8080
echo Done!
pause






1 comment:

  1. Really nice info. I was facing issue with tfs build because build service was registered with network service. After changing it to current user my problem got solved.

    ReplyDelete