I've already used a TFS username "username2015" when connecting to my
client's TFS in Team -> Manage Connections in VS 2015. Now in VS 2017,
I want to use another username 'username2017' to connect to same TFS.
Firstly make sure the username2017
is added in TFS, see Quickstart: Add users to a team project or specific team
If it's the FIRST TIME connecting to same TFS with VS 2017 under current windows user account, then you can use username2017
directly in VS 2017 (Team Explorer -> Manage Connections), it will popup the login dialog box for you to sign-in, nothing different with VS 2015.
But if you have ever connected to the TFS with other tfs accounts in VS 2017, then it will automatically use your previous logged-on tfs user account from Windows Sign-on services and check if you are able to login to selected TFS Server. That means it will automatically connect to TFS with the pervious tfs account if the account is still available. If the password changed, then it will popup the dialog to let you enter the new password to sing-in again.
So, in your scenario if you have ever connected to the TFS with VS2017 under current user account (windows account to run VS ), then you can try to below ways to run VS2017 as another user:
- Run as different user as Pankaj mentioned above.
Command to run Visual Studio as another user:
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
runas /netonly /user:<account> devenv.exe
Enter the user password, then Team Explorer > Manage Connections
- Logoff windows user, then logon with another windows user, open VS ->
Connect to TFS with another tfs user.
If you insist on using different tfs accounts to connect the same TFS server in VS under the same windows account, then you can try to remove the tfs related credentials from Credential Manager, clean VS and TFS caches etc... But based on my test, it's difficult to take effect.
You can reference my answers in other threads: