22

I'm having trouble getting TFPT.exe to work at all, even after trying to refresh the cached workspace settings per the usual advice on the internet. See below for a log representative of what I've tried and am seeing. Can anyone explain why "tf get" is able to detemine the workspace, but "tfpt annotate" fails?

C:\tfsproj> set tfptcmd="C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\TFPT.exe"
C:\tfsproj> set tfcmd="C:\Program Files (x86)\Microsoft Visual Studio   10.0\Common7\IDE\TF.exe"
C:\tfsproj> %tfcmd% workspaces /s:http://tfs:8080/tfs/Apps
Collection: tfs\Apps
Workspace Owner          Computer Comment
--------- -------------- -------- ---------------------------------------------
DAVID     David_Zarlengo DAVID

C:\tfsproj> %tfcmd% get /preview
C:\tfsproj\src\:
Replacing Readme.txt

C:\tfsproj> %tfptcmd% annotate src\Readme.txt
Unable to determine the workspace

When I edit the workspace in Visual Studio 2010, the "Working folders" grid contains 3 rows, one of which is "Active, $/Foo, C:\tfsproj", therefore, I assume the folder is mapped correctly.

cross-posted on Team Foundation Server – Power Tools & Add-ons

davidzarlengo
  • 820
  • 1
  • 5
  • 16

6 Answers6

33

This suggestion from a similar discussion on MSDN forums helped me:

You need to make sure that you are running the commands from a mapped folder, you can run tf workfold to see if the current folder is mapped or not (i.e in your case run the commands from C:\Temp)

Nikita R.
  • 7,245
  • 3
  • 51
  • 62
  • 1
    I followed all the advice above, which was essential ... the two final pieces that kept me from performing the tfpt task was that 1) I had to be in one of the folders of the Workspace and not just the "root" of the workspace; the operation still did all the folders of the shelveset, and 2) the Shelveset was unshelved in my source working folder, I had to clean it out by performing an Undo (or a Save to Shelveset with the same name so as to overwrite the original and then unchecking the Preserve shelveset to get the working folders clean), either way it then worked. – SnapJag Dec 03 '15 at 15:02
18

For those in vs2017: try firing up vs2015 (not 2017), make sure to connect to TFS server in vs2015, and then tfpt worked just fine.

But note: it sounds like the tf powertools commands are being integrated into the new tfs tooling, so tfpt is not really a thing in 2017. See Daniel Mann's answer here for more info and helpful links: tfpt.exe on Visual Studio 2017

Community
  • 1
  • 1
JohnnyFun
  • 3,975
  • 2
  • 20
  • 20
  • Great suggestion. I was trying to get TFS 2010 working from within VS Code and the only thing I could do was install VS2015, TFS Power Tools 2015 and finally connect to my TFS from with VS2015. It's now all working! – Phil Mar 15 '18 at 12:50
  • This worked for me also, as soon as I connected my VS2015 to the tfs connection it started working – Payam Sep 25 '18 at 08:40
  • Thanks, I had already tried the others, but as soon as I saw this it made perfect sense. I literally just installed VS 2015 specifically so I could use the power tools making me feel like it's pretty unfortunate that they aren't releasing any for 2017 when they know some key features like migrate aren't implemented yet. I wonder if they've addressed this in VS 2019 yet – TheXenocide Jul 08 '19 at 21:12
15

I had this same error and the problem was that when I ran tfpt from the command line it was resolving to the 2008 version of the power tools instead of the 2010 version.

Run tfpt with no arguments and in the help it dumps out, it tells you which version it is.

Scott Langham
  • 58,735
  • 39
  • 131
  • 204
  • 2
    Thanks! This fixed my issue. Just specify you want the 2010 version in the cmd line: "C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools\tfpt.exe". Be sure to validate which Programs directory you're really installed into. – Osiris Jan 21 '13 at 22:47
  • This lead me to my solution. Wasn't working with vs2017. All I had to do was fire up vs2015 and then tfpt worked just fine. – JohnnyFun Nov 01 '17 at 20:10
5

After taking a fresh look at this, it turns out that 'C:\tfsproj' is a directory symbolic link to 'C:\some\nested\path'. Running the TFPT command from the nested path works as expected.

Interestingly, the TFS workspace was mapped to the nested path, so it is surprising that TF commands (e.g. tf get /preview) were able work correctly from the alias path.

I suspect that TFPT does not follow NTFS directory symbolic links correctly when determining the workspace.

davidzarlengo
  • 820
  • 1
  • 5
  • 16
2

As long as you are inside the working directory, tfpt annotate should work. If you are getting the message "Unable to determine the workspace" then it is a caching issue.

If, as you said, you ran tf workspaces /s:serverURL and it still doesn't resolve I would try creating a new workspace and testing it out there. If that works then something wrong with the workspace obviously and I would just delete it and use the new one. If both fail then of course there is a bigger problem but that is how I would approach it.

Mike Veigel
  • 3,795
  • 2
  • 20
  • 28
1

In my case, here is how I arrived to this problem (error message "Unable to determine the workspace"), and how I solved it.

Arrival:

I had some code. The development moved from the branch in which I worked (lets call it Branch1) to Branch2. I had to continue under Branch2. I shelved the changes, re-mapped my development folder to Branch2, opened Developer Command Prompt for VS2012 and ran the following command

tfpt unshelve /migrate /source:"$/path/Branch1" /target:"$/path/Branch2" "Shelveset Name"

Here I've got the "Unable..." message

Solution:

In my case, the problem was that when I opened command prompt, its working directory was c:\program files\...\...Visual Studio 11.... It worked (migrating shelveset) when I changed working directory to the directory of the Branch itself: c:\MyBranchFolder

T.S.
  • 18,195
  • 11
  • 58
  • 78