40

I want to switch the Visual Studio user but I got the following error.

We were unable to establish the connection because it is configured for user user@mydoamin.de but you attempted to connect using user boas.enkler@mydomain.de. To connect as a different user perform a switch user operation. To connect with the configured identity just attempt the last operation again.

I also tried to reset the user data like described here in this post but nothing changed. I also reinstalled Visual Studio and that didn't help.

Any hint?

Screenshot

freginold
  • 3,946
  • 3
  • 13
  • 28
Boas Enkler
  • 12,264
  • 16
  • 69
  • 143

5 Answers5

52

There are two workable options I now use (in order):

As of Visual Studio 2013 Release 4

  • Ensure you login correctly using the current user ID it expects first.
  • Then logout from the Account Settings option on the account drop-down menu (top right, usually showing your name)
  • Now login again using the other account

It appears VS simply does not like to login to a different account while you are already logged in. Just make it happy first :)

Fallback option: You need to run devenv /resetuserdata at the command prompt.

To run the “switch user operation”:

  • Close all instances of VS2013 (Check Task Manager to make sure devenv.exe is not running).
  • Open a Developer Command Prompt for VS2013.
  • Type devenv /resetuserdata and wait for it to complete,.
  • Restart VS2013 and follow the usual “sign in” steps (with the desired account).

This process clears the same registry keys (and a few more) suggested by other solutions.

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
  • Do you know if this only works on newer versions ? (SP2 / SP3 ) ? In the past this didn't worked – Boas Enkler Sep 22 '14 at 10:09
  • @Boas Enkler: Just did this today on VS2013 SP3 and it cleared my problem. (Had to find the `devenv` folder manually to run the command though, as my 2013 commands prompts are missing). – iCollect.it Ltd Sep 22 '14 at 10:32
  • 2
    This works but it's utterly ridiculous. Why even give you the option to sign out if you have to do things like this? – user4593252 Jan 18 '15 at 05:09
  • @MetalPhoenix: you seem to be under the impression that Visual Studio is something more than just a very complex software package written by flawed humans working to a deadline :) My entire Dev environment is now in a VM to avoid having to reinstall my entire PC *again* when something related to VS breaks! – iCollect.it Ltd Jan 18 '15 at 09:55
  • @TrueBlueAussie: haha, no. I wish I lived in that dream world. It's just that this solution is a sledgehammer approach. I've been on the receiving end of having to reinstall windows because of VS problems before and it's a contributing factor as to why I'm building another box. – user4593252 Jan 19 '15 at 15:24
  • 1
    @MetalPhoenix: `devenv /resetuserdata` is hardly a "sledgehammer". User settings problems are specifically what it was designed to fix and is more likely to be future-proof than single registry hacks.:) – iCollect.it Ltd Jan 19 '15 at 16:20
  • @TrueBlueAussie: I'd have to say that there's a big difference between switching users and having user config issues. Reseting the settings is not an appropriate solution to allow VS to login with different user credentials to an online TFS server. Login != settings – user4593252 Jan 20 '15 at 14:17
  • 1
    @MetalPhoenix: It is an appropriate solution when things go wrong and less harmful than Regedit changes. Suggest you post your own answer please instead :) – iCollect.it Ltd Jan 20 '15 at 14:19
  • @TrueBlueAussie: http://blogs.msdn.com/b/visualstudioalm/archive/2012/08/29/clearing-the-credentials-for-connecting-to-a-team-foundation-server.aspx Enjoy! – user4593252 Jan 20 '15 at 16:06
  • The devenv /resetuserdata solution worked fine on my machine. I looked at that blog link, but couldn't follow the steps to find the entries indicated, so no enjoyment there... – Mike Honey Jan 28 '15 at 01:11
  • You can do this and, yes, it does work. But it's a bit of a sledgehammer approach because it will also reset your preferences such as changing those all-caps menus back to all-caps if you've changed it. You can manage it in "Manage your network passwords" section of the control panel as per my answer. – user4593252 Jun 03 '15 at 13:43
  • @MetalPhoenix: using emotive phrases such as "sledgehammer approach" does not invalidate this as a useful option. I only stated it was better than the *hacking the registry* option. Your own solution appears to be a recent additional to VS, but that is no reason to down-vote this answer :) – iCollect.it Ltd Jun 03 '15 at 14:50
  • This does also work with normal command prompt. Since i have only visual studio shell (Just for managing TFS-SourceCountrol), i have no developer command prompt. So i tried with normal command prompt actually worked. Just had to apply the full path of devenv.exe – Daniel Nov 04 '16 at 13:07
  • Downvoters please comment rather than "hit and run". If there is a new solution post it. – iCollect.it Ltd Nov 17 '16 at 13:53
18

Meanwhile I found it. In addition I had to delete a registry key

hkey_current_user\software\Microsoft\VSCommon\12.0\clientservices\tokenstorge\visualstudio\ideuser

It seems like this key is neither affected by resetting the environment nor uninstalling VS 2013.

From this MSDN Forum post:http://social.msdn.microsoft.com/Forums/en-US/d2ef5828-ce0b-405a-b0b8-9809fc8ac0f7/cant-switch-user-in-visual-studio-2013?forum=visualstudiogeneral

Boas Enkler
  • 12,264
  • 16
  • 69
  • 143
7

FYI the path to "devenv.exe" is (for windows 8.1, Visual Studio 2013)

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

So you can navigate there in any plain old command prompt and run

devenv /resetuserdata

Then log in to VS2013 as usual.

peter
  • 71
  • 1
  • 2
  • 1
    weird but for me what MS solution provided (via MetalPhoenix post) did not do the trick; but this worked. thanks! I am using VS 2013 community edition – ovi Jan 12 '16 at 12:18
  • 1
    deleting reg key didn't work for me, this did. Thanks! – GôTô Feb 03 '16 at 16:29
3

I know this is old and you've already selected an answer, but here is the official answer from Microsoft

From the article:

all you need to do is go to control panel > User Accounts > Manage Your Network Passwords select the Team foundation Server and choose remove - viola! Next time you go into Team Explorer you will be prompted for a new set of credentials.

user4593252
  • 3,496
  • 6
  • 29
  • 55
3

I had the same issue, also described here, although the message persisted because of TFS connections.

Using Visual Studio 2013 Premium on Windows 2012 Server

  • tried the registry option, but it did nothing as far as I can tell;
  • used the devenv /resetsettings option, although this just mucked up the settings - I also had to browse to the full path to do it: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE;
  • used devenv /resetuserdata, but this wipes out everything set up, including extensions I think.

I then used the switch user option when connecting to a project and the error message went away.

(I think I may have also tried the signing out of Visual Studio option at some point beforehand as well, but I don't recall as it was a busy day!)

Community
  • 1
  • 1
SharpC
  • 6,974
  • 4
  • 45
  • 40