353

A new feature of Visual Studio 2013 is the ability to sign in with a Microsoft Account and have your settings be persisted across all of your instances of Visual Studio, amongst other things.

When I installed Visual Studio 2013 Preview I signed in with one of several Microsoft Accounts I hold.

I've now installed the RTM version of Visual Studio 2013 (after uninstalling the Preview version) and that has kept my previous user sign in credentials.

I would now like to change these sign in credentials to be a different Microsoft Account but every time I attempt to sign in with the new details I receive a message similar to the following

We were unable to establish the connection because it is configured for user olduser@old.com but you attempted to connect using user newuser@new.com. To connect as a different user perform a switch user operation. To connect with the configured identity just attempt the last operation again.

The problem is I can't find any documentation anywhere on how to perform a "switch user operation". Maybe I'm just not looking hard enough but hopefully someone here can help me out.

Dewi Rees
  • 3,707
  • 2
  • 19
  • 20

18 Answers18

609

There is a comment about this under this answer, but I think it's important to list it here. If you want to preserve your settings, export them first because they will be lost.

From MSDN forums - since I had to hunt around far too much to find the solution to this:

  1. Close Visual Studio
  2. Start the Developer Command prompt installed with Visual Studio as an administrator.
  3. type 'devenv /resetuserdata' ('wdexpress /resetuserdata' for Express SKUs)
  4. Start Visual Studio Normally.

Worked for me.

Dewey Vozel
  • 2,257
  • 1
  • 19
  • 22
Derek
  • 6,162
  • 1
  • 12
  • 4
  • 11
    Dereks answer works for me. Note that if you have exress versions you have to replace devenv with the name of the executable. Check where to shortcut points to. For desktop express it's WDExpress.exe and for web its vwdexpress –  Dec 08 '13 at 19:47
  • 18
    To preserve the settings (windows, themes, fonts) you may want first Export your settings to a file, then do the reset, then Import the settings back. I didn't find Developer Command Prompt in default windows 8 metro search, so had to go c:\program files (x86)\microsoft visual studio 12.0 direct. – Max Jan 13 '14 at 09:11
  • 2
    It also cleared my installed extensions. Any way to keep those for the new user? – Robert Fricke Feb 12 '14 at 14:19
  • 15
    They should provide a link or button inside that dialog to actually do the operation so we don't have to go hunting for instructions. – Ben Collins Apr 07 '14 at 00:22
  • 11
    Also, if you want to find the developer command prompt in windows 8, follow these images: 1. http://i.imgur.com/TcnSEPF.png 2. http://i.imgur.com/jDf3GYt.png 3. You should be able to take it from here. – Joel McBeth Apr 09 '14 at 22:35
  • 3
    For whom use VS2013 with Win8+, Dev Command Prompt may not include a shortcut, can reach from clicking the '..tools' shortcut from `C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2013` – Beytan Kurt Jun 02 '14 at 18:29
  • Just a quick headsup to try and save a couple of hours from the lives of those using the resharper plugin: After I followed the above procedure VS started to lag pretty badly. I turned out that uninstalling resharper + reseting all VS settings to the default ones + reinstalling resharper + reimporting the settings (if you had saved them to begin with) solved the problem at hand (go figure ...). Just my 2c. – XDS Jul 22 '14 at 13:38
  • 3
    This answer is far too broad and destructive to your development environment. @Abraham's answer below is fixes the exact problem without loosing all your settings. – stricq Sep 16 '14 at 17:58
  • The answer above worked to get me logged in under Visual Studio. It also cleared the Team Foundation Server configuration (that had persisted after trying the answer from @Ambrose below). At this point, the Connect to TFS dialog still rejected me, but in that dialog (as opposed to Team Explorer pane) there is a Switch User link, which worked. – Mike C Jan 22 '15 at 23:48
  • 13
    for me the devenv tool was located in my machines `C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE` i had to open normal command prompt as admin, and the run the tool from this location. – Rahmathullah M Feb 11 '15 at 06:06
  • If you want there is a SO thread about the [Developer Command prompt](http://stackoverflow.com/questions/21476588/where-is-developer-command-prompt-for-vs2013). – aloisdg Apr 01 '15 at 16:16
  • Using git for SCM, I needed to move.git file in Documents folder else CI history would be messed up.
    mv .\.gitconfig .\.gitconfig-delete-me-after-1-year 
    Visual Studio Community 2013 Update 4 on Windows 8.1. I'm using git for source control instead of TFS SCM at *.visualstudio.com online. I'm trying other solutions.
    – Skurfur Apr 20 '15 at 05:01
  • this shouldn't be the accepted answer because there is a simple way to switch user: click the name, then settings, log out and sign in with the second one – user3290180 Sep 25 '15 at 16:08
  • Should be noted where to find this because with my computer I could not find DCP. Tools > Developer Command Prompt !!! OR !!! Tools > External Tools > Add... For a tutorial for here click https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx#Anchor_2 then once added you'll see it in the first place I wrote. Launch it and close VS – EasyBB Oct 22 '15 at 20:58
  • This answer is far too broad and destructive to your development environment. @Ambrose-Little's answer below fixes the exact problem without loosing all your settings, or deleting anything. – GraehamF Jan 27 '16 at 16:48
  • 1
    @BenCollins, I added this as a suggestion to the Visual Studio User Voice. I know I'm a few years late to the party, but this continues to be a problem for me. https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/13348800-allow-users-to-switch-users-when-signing-in-with-a – Kevin Adams Apr 07 '16 at 23:10
  • I needed to sign out first. without that the command did nothing. idk if its because im on VS 2015 or an oversight in directions – owen gerig May 13 '16 at 14:16
  • "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts" – George Norberg Oct 17 '16 at 10:45
  • Here's the location for VS2017 command prompt: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools>vsdevcmd.bat – Daver Aug 30 '18 at 19:29
  • It worked as a charm! Just type in Start Menu Search and type "Visual Studio Tools", hit enter, and in new window, you will find Developer Command Prompt Shortcut, run it as Admin and repeat command by @Derek – Shadab Mozaffar May 04 '20 at 19:44
  • I found another solution (or in my case, the only one, since reset didn't help): Log out from VS and restart VS. Deny all login prompts and go ahead to add the desired connection. Only after the final "add"-click, you should login yourself. This worked for me. After that, I logged in normally again in VS. – RUL Mar 04 '21 at 06:13
127

I was able to fix this by: 1) Sign in as the old user. 2) Sign out. 3) Sign in as new user.

In my case, it appears that it wanted to verify my license on the old account first, before it would let me switch to a new one.

Ambrose Little
  • 2,111
  • 2
  • 15
  • 15
  • VS does not allow me to login using different a microsoft account (which IMO is retarded). Derek's steps worked for me. Maybe there are situations in which one can use a different ms account, but as I said, I was not able to. – steve Sep 08 '14 at 16:48
  • devenv did not work for me so I tried this and Waaala! works, thanks @ambrose – JQII Oct 24 '14 at 01:02
  • worked for me in visual studio 2013 community.If your username has yellow exclamation icon beside it.you need to sign it and sign out again – kypronite Jan 26 '15 at 02:14
  • If using git for SCM instead of TFS, I needed to move .gitconfig file in Documents folder else check-in history would be messed up. To solve, close VS, use this command in your home dir: 'mv .\.gitconfig .\.gitconfig-delete-me-after-1-year', open VS, and setup your git credentials again. I'm using Visual Studio Community 2013 Update 4 on Windows 8.1 connected to server *.visualstudio.com for TFS. – Skurfur Apr 20 '15 at 05:10
  • 2
    @user3290180 This only works if you know the account credentials, though. My work computer came from someone else who installed VS for me. – Brian J Jan 14 '16 at 16:49
117

I resolved this problem by deleting the registry key under

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

Ian Kemp
  • 28,293
  • 19
  • 112
  • 138
ionat
  • 1,979
  • 1
  • 16
  • 15
  • 9
    I did this. It looked funny, I had two matching locations, strangely with empty keys, and I deleted an entire parent tree that seems otherwise empty. I do **prefer this method** over the "nuclear" option described in the accepted answer. I mean, I know about that option for a long time but I'm not ready to delete all settings/caches over petty account UX fails :) – sehe Jan 16 '14 at 15:11
  • @sehe: Please expand on "two matching locations" – Lightness Races in Orbit Jan 16 '14 at 15:13
  • @LightnessRacesinOrbit Sadly I can't, because I deleted them without any worries :) However, I searched the registry for all keys/values/data that exactly matched the _whole string_ `ideuser`: http://i.stack.imgur.com/j9qIX.png (btw: this is **not** my answer. I'm simply reporting success and sharing my preference) – sehe Jan 16 '14 at 15:19
  • @sehe: You answered my question. :) Wasn't sure how far up the "directory" tree you were counting as "matching", basically. – Lightness Races in Orbit Jan 16 '14 at 15:35
  • I deleted a key named "12.0" or similar at the root. It was ~5 levels deep. And contained nothing outside that _empty_ `ideuser` key – sehe Jan 16 '14 at 15:43
  • 1
    this is way better then the accepted answer as I don't want to delete all other settings! – DATEx2 Nov 25 '14 at 13:25
  • 4
    This worked great for me. I made a simple `ideuser-delete-VS2015.reg`. https://gist.github.com/ctaggart/567686421be0822420bc – Cameron Taggart Mar 03 '15 at 06:11
  • This worked for me. What I did exactly is to delete the key folder contained in \ideuser (the name consists of 32 alphanumeric characters). **Note**: VS claimed _"This product is licensed to: [previously signed in user]"_ but I could sign in correctly and my subscription was downloaded automatically. – Søren D. Ptæus Sep 29 '15 at 14:13
  • Powershell to backup & remove the current item `push-location 'HKCU:\software\Microsoft\VSCommon\12.0\clientservices\tokenstorage'` `move-item .\VisualStudio .\VisualStudio_Backup` `pop-location` – JohnLBevan Dec 10 '15 at 19:02
  • 1
    For Visual Studio 2015 Community Edition & Windows 10, this answer worked where the accepted answer did not. – stephenhouser Mar 31 '16 at 14:17
  • 1
    This solution is great as on my other machine the user was logged out and I didn't remember the old account password:( Now everything is working – Mansoor May 07 '16 at 10:48
  • 2
    Worked great for VS2013. Here's a gist for that: [ideuser-delete-VS2013.reg](https://gist.githubusercontent.com/diaconesq/bac3322ec0e5a38895351e100eee36ec/raw/fb46967e8755c153877b009b6b001e5298da8331/ideuser-delete-VS2013.reg) - r-click, save link as. (Just retrofitted @CameronTaggart gist to work for VS2013) – Cristian Diaconescu Nov 09 '16 at 11:49
  • In my case, the MS account signed into VS no longer existed so I could not just login and then logout. Deleting this registry key did the trick so I could login with another MS account! Thank you!!! – Tim Sexton Jan 03 '17 at 15:45
21

None of the above worked for me - the following did:

devenv /ResetSettings

The nice thing about this option was it didn't wipe out all of my Visual Studio configuration (as /ResetUserData does)

BillKrat
  • 291
  • 2
  • 6
  • This one worked for me as well! I've had a problem with my Visual Studio since my company gave me a MSDN subscription. I previously had a "personal" Visual Studio Online account with my work email, but when I switched to MSDN, I had 2 accounts associated with the same email. I deleted the personal account, but couldn't get Visual Studio to recognize it. This solution fixed my errors that I was continuously getting. I wish there was a way to move this answer to the top! – Howard Renollet Apr 18 '16 at 13:45
  • This is definitely the better answer. But I've updated it to say that you need to sign out before running this command. – Megaroeny Mar 10 '17 at 15:50
19

You don't need to reset all your user data to switch users. Try clicking on your name in the upper right corner then click on "Account settings". There you will get an option to sign out of the IDE. Once signed out you can sign back in as another Microsoft account.

Anthony
  • 191
  • 1
  • 3
  • 5
    For me this answer is incomplete and still results in the "you are configured for *a* but you attempted to connect using user *b*". **You must first sign in successfully with the current user, then sign out.** Then it works. – iCollect.it Ltd Jul 09 '15 at 13:22
  • 4
    This is not possible if you need to switch because you let the trial expire on an old user account before bothering to switch to a new (paid) account, as once the trial expires you are locked out of the UI all together. – Wayne Jan 18 '16 at 17:49
7

I faced this issue Many time from different scenarios

one of them when I tryed Connecting to team foundation server for different Logged User

enter image description here

so the solution is easy Just Click Switch User

hope this help you

Basheer AL-MOMANI
  • 14,473
  • 9
  • 96
  • 92
6

Derek's answer above didn't work for me. I am using VS 2013 Ultimate and after signing out of Visual Studio, when i tried to sign in as another user, it gave error.

Then when connecting to the Team Project i saw the option to switch user, which is what i wanted all along.

Tarun
  • 2,808
  • 3
  • 22
  • 21
  • 2
    You need to make sure that you in fact running this parameter on correct devenv. Press start look for Visual Studio 2013, right click and select "Open file location". Open command line there (as admin) and type in 'devenv /resetuserdata'. – Luke Jan 07 '14 at 06:09
  • Thanks! I tried all the options, the registry key did nothing, resetuserdata worked but it wipes out all settings, this finally fixed it! – SharpC Sep 10 '15 at 14:01
3

what worked for me was to go to Team explorer in VS2013 and under 'connect' you'll see a link saying 'select team projects'. click this and a window opens asking you to select the project but in the bottom left corner of this window there is a (switch user) link, just click this and use your new id. simple

Alex Stephens
  • 3,017
  • 1
  • 36
  • 41
  • 1
    The link is not available on my window. – AngieM Mar 20 '15 at 14:21
  • The link is available to me and this solution works. Thanks. – Mike Malter Mar 09 '16 at 20:02
  • This changes the user that connects to TFS, not the user for Visual Studio. They are not necessarily the same and the TFS user controls your access to the Team projects while the Application user holds your license. – Wayne Nov 03 '16 at 17:05
2

Thanks.. only one that fixed mine was the command prompt. Devenv is located under VisualStudio 12.0 Directory under common7\IDE if it helps..

  • THere is also a shortcut from the start menu under Visual Studio in Visual Studio Tools called Developer Command Prompt for Visual Studio VS2013... – user2933604 Jul 14 '14 at 17:10
  • This was actually very helpful to me. For some reason I had no dev command prompt but was able to run it here. – KJ3 Mar 03 '15 at 18:19
2

Start Visual Studio Tools -> Import and Export Settings -> Export selected environment settings You need to be really quick to navigate the menu before Licensing pop-up appears, (this step is optional: worst case scenario you would have to restore all the settings manually). Once in "Import and Export Settings" dialogue you can relax.

Exit Visual Studio.

From the command prompt run: devenv /resetuserdata for the particular Visual Studio version.

Safest way is to right-click on the shortcut -> Properties -> Shortcut -> Target -> copy. Final command should look something like:

"C:\Program Files (x86)\Microsoft Visual Studio NN.N\Common7\IDE\devenv.exe" /resetuserdata

Go through log-in and initial settings.

Tools -> Import and Export Settings -> Import selected environment settings to restore your original settings.

This worked when the error:

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

...has both instances of email@address identical.

Y.B.
  • 3,526
  • 14
  • 24
2

I have Visual Studio 2013 Express. I had to delete the registry key under:

hkey_current_user\software\Microsoft\VSCommon\12.\clientservices\tokenstorge\VWDExpress\ideuser
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Valeraine
  • 21
  • 1
2

For Visual Studio 2019 it wasn't working by signing out/ signing in, etc. as mention in other solutions. What simply worked was performing the operation from new branches window/section. i.e,

1. Click on:

Git Changes interface

2. It opens up the branches section as below. Then right click on desired branch and perform the operation which wasn't working earlier. (for me, it was PUSH that wasn't throwing this error) new branching interface in VS2019 upgrade

(in VS 2019 new Git interface, I usually push/pull/fetch from the small arrows as shown in first screenshot. But sometime they throw error (mentioned in question) and do not allow pushing/pulling. What then what worked was the solution I mentioned above. May be it's a bug or something, but this solution saves you from resetting user data, and mess of signing out/in from multiple accounts, etc.)

Zeeshan
  • 2,884
  • 3
  • 28
  • 47
1

For VS 2013, community edition, you have to delete the registry keys found under: hkey_current_user\software\Microsoft\VSCommon\12.0\clientservices\tokenstorge\visualstudio\ideuser

Brian
  • 3,653
  • 1
  • 22
  • 33
0

I was also able to fix this by signing in putting my product key in and then signing out and then logging in under my new login.

Dalkeith
  • 32
  • 1
  • 3
0

Execute VSWinExpress /resetuserdata, located in C:\Program Files (x86)\Microsoft Visual Studio 12.0, to reset the user credentials for Visual Studio 2013 Express.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
ggriff
  • 1
  • 1
0

what did the trick for me, I just deleted the .vs folder and wallah it start working again.

It's i think a common bug, sometime visual studio stuck on error, although you have fix them too, you just need to remove the .vs code and everything goes back the way it should be.

0

In my case the Git account authentication token saved in Visual Studio had expired.

Open Visual Studio -> Help -> Register Visual Studio -> Click on "reinsert crediatial" in correspondence with the account -> login.

jangix
  • 49
  • 7
-1

If the Command prompt don't work for you, try logging in with your account that is working then log out and then try again with your other account.

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
Khasha
  • 1,559
  • 1
  • 12
  • 19