microsoft / azure-repos-vscode

Azure Repos extension for VS Code
Other
663 stars 451 forks source link

Extension thinks TFVC workspace is a Server workspace, when it's clearly Local #325

Closed tevert closed 3 years ago

tevert commented 6 years ago

Viewing the workspace through Visual Studio shows it as a local, workspace, like the README's instructions. However, after authenticating in VSCode, I get an error popup "(team) It appears you are using a Server workspace. Currently, TFVC support is limited to Local workspaces."

The workspace is to our VSTS account.

How does the extension determine the workspace type?


Update after some quick digging - it looks like the extension views "Unauthorized" errors as indicators of a Server workspace. I've tried using both PAT and browser auth flows, neither of those resolved the issue.

zoinkydoink commented 6 years ago

same problem, posted a issue 2 weeks ago on here, no response at all

curtisault commented 6 years ago

I'm having the same issue and have verified in VS 2017 that the Workspace is a "Local Folder". I will follow up if I find anything.

I'd also like to point out that this error shows up for me when I open a folder that is not in source control.

Here's the log:


2017-10-26T18:11:38.098Z - info:   [06792] VSTSVSCode/1.122.0 (VSCode 1.17.2; Windows_NT 10.0.15063; Node 7.9.0)
2017-10-26T18:11:38.098Z - debug:  [06792] Looking for an External Context at c:\HCBB
2017-10-26T18:11:38.098Z - debug:  [06792] No External Context at c:\HCBB
2017-10-26T18:11:38.099Z - debug:  [06792] Looking for TFVC repository at c:\HCBB
2017-10-26T18:11:38.099Z - debug:  [06792] TFVC Creating Tfvc object with localPath='undefined'
2017-10-26T18:11:38.099Z - debug:  [06792] Using TFS proxy: 
2017-10-26T18:11:38.099Z - debug:  [06792] TFVC Retrieved from settings; localPath='C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe'
2017-10-26T18:11:38.099Z - debug:  [06792] TFVC Repository created with repositoryRootFolder='c:\HCBB'
2017-10-26T18:11:38.099Z - debug:  [06792] TFVC Repository.CheckVersion
2017-10-26T18:11:38.099Z - debug:  [06792] TFVC: tf add -noprompt -?
2017-10-26T18:11:38.103Z - debug:  [06792] TFVC: spawned new process (duration: 3ms)
2017-10-26T18:11:38.163Z - debug:  [06792] TFVC: add exit code: 0 (duration: 63ms)
2017-10-26T18:11:38.163Z - debug:  [06792] TFVC Minimum required version: 14.102.0
2017-10-26T18:11:38.163Z - debug:  [06792] TFVC (TF.exe, TF.cmd) version: 15.117.26914.0
2017-10-26T18:11:38.163Z - debug:  [06792] TFVC Repository.FindWorkspace with localPath='c:\HCBB'
2017-10-26T18:11:38.164Z - debug:  [06792] TFVC: tf workfold -noprompt ********
2017-10-26T18:11:38.166Z - debug:  [06792] TFVC: spawned new process (duration: 2ms)
2017-10-26T18:11:38.998Z - debug:  [06792] TFVC: workfold exit code: 100 (duration: 834ms)
2017-10-26T18:11:38.999Z - debug:  [06792] TFVC errors (via stderr): TF30063: You are not authorized to access hcbb.visualstudio.com\DefaultCollection.

2017-10-26T18:11:38.999Z - error:  [06792] It appears you are using a Server workspace. Currently, TFVC support is limited to Local workspaces. TF30063: You are not authorized to access hcbb.visualstudio.com\DefaultCollection.
2017-10-26T18:12:04.316Z - info:   [18700] *** FOLDER: c:\HCBB ***
2017-10-26T18:12:04.319Z - info:   [18700] VSTSVSCode/1.122.0 (VSCode 1.17.2; Windows_NT 10.0.15063; Node 7.9.0)
2017-10-26T18:12:04.320Z - debug:  [18700] Looking for an External Context at c:\HCBB
2017-10-26T18:12:04.320Z - debug:  [18700] No External Context at c:\HCBB
2017-10-26T18:12:04.322Z - debug:  [18700] Looking for TFVC repository at c:\HCBB
2017-10-26T18:12:04.322Z - debug:  [18700] TFVC Creating Tfvc object with localPath='undefined'
2017-10-26T18:12:04.323Z - debug:  [18700] Using TFS proxy: 
2017-10-26T18:12:04.323Z - debug:  [18700] TFVC Retrieved from settings; localPath='C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe'
2017-10-26T18:12:04.324Z - debug:  [18700] TFVC Repository created with repositoryRootFolder='c:\HCBB'
2017-10-26T18:12:04.324Z - debug:  [18700] TFVC Repository.CheckVersion
2017-10-26T18:12:04.326Z - debug:  [18700] TFVC: tf add -noprompt -?
2017-10-26T18:12:04.331Z - debug:  [18700] TFVC: spawned new process (duration: 4ms)
2017-10-26T18:12:04.337Z - debug:  [18700] TFVC: spawned new process (duration: 5ms)
2017-10-26T18:12:04.660Z - debug:  [18700] TFVC: add exit code: 0 (duration: 334ms)
2017-10-26T18:12:04.662Z - debug:  [18700] TFVC Minimum required version: 14.102.0
2017-10-26T18:12:04.662Z - debug:  [18700] TFVC (TF.exe, TF.cmd) version: 15.117.26914.0
2017-10-26T18:12:04.662Z - debug:  [18700] TFVC Repository.FindWorkspace with localPath='c:\HCBB'
2017-10-26T18:12:04.662Z - debug:  [18700] TFVC: tf workfold -noprompt ********
2017-10-26T18:12:04.665Z - debug:  [18700] TFVC: spawned new process (duration: 2ms)
2017-10-26T18:12:05.312Z - debug:  [18700] TFVC: workfold exit code: 100 (duration: 649ms)
2017-10-26T18:12:05.314Z - debug:  [18700] TFVC errors (via stderr): TF30063: You are not authorized to access hcbb.visualstudio.com\DefaultCollection.

2017-10-26T18:12:05.314Z - error:  [18700] It appears you are using a Server workspace. Currently, TFVC support is limited to Local workspaces. TF30063: You are not authorized to access hcbb.visualstudio.com\DefaultCollection.
Anton987 commented 6 years ago

I have exactly the same issue...

philcatterall commented 6 years ago

I have the same issue too. Tried all the tricks. Updated VS. Still thinks it’s a server workspace. Does anyone have any ideas ?

prasannawagh commented 6 years ago

Have the same issue. Looks like something got updated either in Code of in TFVC which broke this. Need this to be fixed soon :(

softarch74 commented 6 years ago

Same thing here. It was working a few days ago.

prasannawagh commented 6 years ago

I tried something and It Worked! Can't say for sure if this is a good solution or THE solution. Still don't understand what messed it up in the first place but here's what I did. Went to Visual Studio and connected to Team server then opened workspaces and as I knew it was Local. But then I changed it to Server and then again changed it back to Local. Only TFS knows what it did but now Code is able to connect to team services properly.

Hope this works for others!

wallden commented 6 years ago

Same here. Just chipping in to show the urgency. Tried everything I could find online

curtisault commented 6 years ago

I changed it to Server and then again changed it back to Local. Only TFS knows what it did but now Code is able to connect to team services properly.

@prasannawagh I tried this, it did not work for me.

mqueirozcorreia commented 6 years ago

I was having the same problem, and now it works! I think is what @prasannawagh said, but with a important step to follow.

I have Visual Studio 2015 and Visual Studio Team Explorer 2017 installed. The solution: 1) Open Visual Studio Team Explorer 2017 2) Connect to TFS 3) Click in Source Control Explorer 4) Edit Workspaces 5) Change the used workspace to Server 6) Change the same workspace to Local (It refreshes the folder "$tf") 7) Open a new and unique instance VS Code 8) Make sure you reference tf.exe 2017 in Settings (File -> Preferences -> Settings), as below (Use your VS 2017 installation path): "tfvc.location": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/tf.exe" 9) Command Pallete (F1) 10) Team: Signin

Let me know if this works for you.

piwibardy commented 6 years ago

@mqueirozcorreia your method is not working for me :/

mqueirozcorreia commented 6 years ago

How was the log after the process? Does It make any difference?

piwibardy commented 6 years ago

the log?

mqueirozcorreia commented 6 years ago

Yes

russgove commented 6 years ago

any update on this, I'm having the same issue. How do you get to those logs you are showing above?

mqueirozcorreia commented 6 years ago

The main point is to use VS Team Explorer 2017.

The generate the log, please see the Logging info at readme.md

tim-hutch commented 6 years ago

I started receiving this error after I updated to the latest version of VS Code today. I also changed my network password yesterday which is stored in ADFS so I don't know if maybe that would have anything to do with it or not. I tried following @mqueirozcorreia directions, but without success. I also tried signing out and signing back in, as well as changing my Microsoft Password to match my network password, but without any luck. The error I am receiving in my log is:

You are not authorized to access [repository]

This doesn't seem to make any sense since just yesterday it was working and I am still able to access the repository from Visual Studio 2017 Team Explorer & the web interface.

mqueirozcorreia commented 6 years ago

Have you tried to create a new local repository? Do you have VS 2015? Don't use it! Use VS 2017, at least, Team Explorer.

markusmauch commented 6 years ago

Nothing of the above works for me. Here's my log:

2017-11-30T15:34:36.228Z - error: [11008] Could not find a workspace with mappings (e.g., not a TFVC repository, wrong version of TF is being used). Unable to determine the source control server. 2017-11-30T15:38:21.944Z - info: [12560] FOLDER: d:\Repositories\WebClient 2017-11-30T15:38:21.946Z - info: [12560] VSTSVSCode/1.122.0 (VSCode 1.18.1; Windows_NT 10.0.14393; Node 7.9.0) 2017-11-30T15:38:21.948Z - debug: [12560] Looking for an External Context at d:\Repositories\WebClient 2017-11-30T15:38:21.948Z - debug: [12560] No External Context at d:\Repositories\WebClient 2017-11-30T15:38:21.950Z - debug: [12560] Looking for TFVC repository at d:\Repositories\WebClient 2017-11-30T15:38:21.950Z - debug: [12560] TFVC Creating Tfvc object with localPath='undefined' 2017-11-30T15:38:21.950Z - debug: [12560] Using TFS proxy: 2017-11-30T15:38:21.952Z - debug: [12560] TFVC Retrieved from settings; localPath='C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/tf.exe' 2017-11-30T15:38:21.952Z - debug: [12560] TFVC Repository created with repositoryRootFolder='d:\Repositories\WebClient' 2017-11-30T15:38:21.953Z - debug: [12560] TFVC Repository.CheckVersion 2017-11-30T15:38:21.953Z - debug: [12560] TFVC: tf add -noprompt -? 2017-11-30T15:38:21.961Z - debug: [12560] TFVC: spawned new process (duration: 6ms) 2017-11-30T15:38:21.967Z - debug: [12560] TFVC: spawned new process (duration: 6ms) 2017-11-30T15:38:22.199Z - debug: [12560] TFVC: add exit code: 0 (duration: 244ms) 2017-11-30T15:38:22.201Z - debug: [12560] TFVC Minimum required version: 14.102.0 2017-11-30T15:38:22.201Z - debug: [12560] TFVC (TF.exe, TF.cmd) version: 14.102.25619.0 2017-11-30T15:38:22.201Z - debug: [12560] TFVC Repository.FindWorkspace with localPath='d:\Repositories\WebClient' 2017-11-30T15:38:22.202Z - debug: [12560] TFVC: tf workfold -noprompt d:\Repositories\WebClient 2017-11-30T15:38:22.207Z - debug: [12560] TFVC: spawned new process (duration: 5ms) 2017-11-30T15:38:22.300Z - debug: [12560] TFVC: workfold exit code: 100 (duration: 98ms) 2017-11-30T15:38:22.302Z - debug: [12560] TFVC errors (via stderr): Unable to determine the source control server.

2017-11-30T15:38:22.303Z - error: [12560] Could not find a workspace with mappings (e.g., not a TFVC repository, wrong version of TF is being used). Unable to determine the source control server.

ryanfog commented 6 years ago

I just installed this today and have run into the same issue.

Attached is my logfile and screen shot from VS 2017 local Logfile.txt

philcatterall commented 6 years ago

Had a dabble in the source code. See line 77 of commandhelper.ts else if (/TF30063: You are not authorized to access/i.test(result.stderr)) { //For now, we're assuming this is an indication of a Server workspace tfvcErrorCode = TfvcErrorCodes.NotAuthorizedToAccess; message = Strings.TfServerWorkspace; messageOptions = [{ title : Strings.LearnMore, url : Constants.ServerWorkspaceUrl }]; Comparing that with the logs people have posted (same error code) it looks as if there is some kind of permissions/authentication issue (or bug TFS side), but looking at that comment in the code it is being interpreted "for now" as a Server Workspace. Hence this may be a red herring. A quick google of TF30063 turns up quite a lot - this one in particular looks interesting

I'll continue to investigate and re-post here if I find anything.....

philspokas commented 6 years ago

process as described by @mqueirozcorreia worked for me. VS2017 did some scrubbing when switching from Local to Server and then resets workspace when setting back to Local. After this the error goes away and so far so goo.

markusmauch commented 6 years ago

I found a solution that might help other as well. Obviously, I referenced an older tf.exe version in the .vscode/settings.json file. I just changed "tfvc.location": "C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/tf.exe" to "tfvc.location": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/tf.exe" and now everything works perfectly fine.

mqueirozcorreia commented 6 years ago

@markusmauch that is step is important too. I have update my answer adding this as step 8

bednart commented 6 years ago

I had same issue. No above suggestion works for me under VS 2017 Community. I had to install VS 2015 Community, create new local workspace and point tf.exe from there and now it works.

granteagon commented 6 years ago

For me this issue stemmed from improperly checking out the repository. We had just moved our stuff to Azure so I did the first repo incorrectly.

Where I went wrong: I cloned the repo manually by going to the project page and copying the repo url and checking out with git.

How I found a solution: I checked out the project using the Team Services panel in Visual Studio. Once I did that, everything worked automatically once I opened the newly cloned project in Code.

I was also able to get the original repo working by trying different things in this thread, but I'm not sure what finally fixed it.

One key for me getting it to work manually was to turn debug on. I also have the tfvc.location flag set.

{
    "team.logging.level": "debug",
    "tfvc.location": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Common7\\IDE\\CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer\\TF.exe"
}
elvinmeza commented 6 years ago

For anyone else with a similar setup to mine, I have two projects (one is the vs code project) sharing the same workspace and was getting this error. Additionally to the tfvc.location i had to add the tfvc.restrictWorkspace: true, restart vs code, then sign in with the extension. Now it's working as expected.

NanFengCheong commented 6 years ago

After much struggling myself, I finally made it to work. To fix TFVC errors (via stderr): TF30063: You are not authorized to access *.visualstudio.com\DefaultCollection.

  1. Open Developer Command Prompt for VS 2017
  2. Navigate to the workspace root folder
  3. Enter "tf workspace"
  4. Login

Finally it works now. @curtisault, you can try the method above

richvanrooyen commented 6 years ago

That seems to have worked for me NanFengCheong! Thanks for the tip.

mharakeh1 commented 6 years ago

Thank you @NanFengCheong

b-e-n-j commented 6 years ago

Thanks @NanFengCheong

So if I've understood it right, Visual Studio Team Services extension uses the Personal Access Token, but tf.exe still needs the username/password. If not, then misleading errors are produced.

The reason it probably didn't work for me was that I have different Microsoft accounts for my local TFS and remote VSTS, so it's likely tf.exe was using the wrong credentials, although this is just speculation.

zatchgordon commented 6 years ago

@NanFengCheong you are the man. Just spent 3 hours trying to fix this problem and you've solved it

billyjacobs2014 commented 6 years ago

@NanFengCheong s solution worked for me with a slight difference. When I ran the command tf workspace I received this message because I have multiple online workspaces from different hosts. Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.

So I ran tf workspaces /collection:https://myworkspacename.visualstudio.com. Then it prompted me to login and then it all worked. Thanks @NanFengCheong

NOTE: I did have to restart vscode

DDurga commented 6 years ago

It's worked for me below steps, Thanks. Open Developer Command Prompt for VS 2017 Navigate to the workspace root folder Enter "tf workspace" Login

image

HMubaireek commented 6 years ago

Thanks @billyjacobs2014 your solution worked for me.

abidalis commented 5 years ago

After much struggling myself, I finally made it to work. To fix TFVC errors (via stderr): TF30063: You are not authorized to access *.visualstudio.com\DefaultCollection.

  1. Open Developer Command Prompt for VS 2017
  2. Navigate to the workspace root folder
  3. Enter "tf workspace"
  4. Login

Finally it works now. @curtisault, you can try the method above

Working fine... Thanks

seanzi86 commented 5 years ago

I have to do this every so often, is there a more permanent solution?

richvanrooyen commented 5 years ago

I have to do this every so often, is there a more permanent solution?

I ditched VS Code for Visual Studio Pro... I got tired of the fooling around with the tools instead of writing the bloody code! Who has time for this!?!?!

zatchgordon commented 5 years ago

I have to do this every so often, is there a more permanent solution?

I ditched VS Code for Visual Studio Pro... I got tired of the fooling around with the tools instead of writing the bloody code! Who has time for this!?!?!

I code using VS Code and do all my checkins using Visual Studio Pro. Checking in, especially to a task or PBI, is super annoying with VS Code but super easy with VS Pro.

NanFengCheong commented 5 years ago

agreed, VS Code is too slow.

ParadiseCircus commented 5 years ago

I tried the above solutions and none worked, VSCode still thinks my workspace is set on server.

Whenever I try to run the tf workspace command in the root folder of the workspace I don't get a login prompt just the workspace window to make modifications to the workspace and that's it, even making changes from there doesn't fix it.

ryanfog commented 5 years ago

These are my notes on the steps I use to resolve this when it breaks every so often.

When VSTS is not working for source control login is likely expired. Open Visual Studio developer console Go to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer Type "tf vc workspace" Login

ParadiseCircus commented 5 years ago

Nope I still don't get any log in prompt after typing "tf vc workspace" I get taken directly to the window to edit the workspaces I have and that's it, editing from there does nothing as well, the error persists.

viT-1 commented 5 years ago

@ParadiseCircus You can find help for login credentials here like this tf workspaces /computer:* /collection:http://devsrv:8080/tfs/helloworld/ /login:user_name