Visual Studio Source Control Explorer access denied - visual-studio

Recently I have been working on a project and have been waiting to publish it to Azure. Before I was able to do this my local user account on my machine was changed. Now when I try to add the project solution to the solution control explorer I get "access to path [old username]/my documents/projects is denied." I have the project copied from the old user account onto the new one I am using. I opened from this location, but it still seems to reference the old path. How do I change this and/or what settings do I need to change?
I have uploaded the project into the source control explorer for the project, and the rest of the team can view it. It is possible to re-load the project from here and create a new work space mapping on the new local account? If so how can I do this?
I managed to get it moved by doing the following, thanks jessehouwing for the push in the right direction.
Closed Visual Studio
Went to old account, copied project directly to the C drive
Went to the new account, opened the project from there
Deleted mapping referenced in the picture in jessehouwing's answer
Created new mapping under a different name, because even though the old one was removed, there was still a naming conflict (I have no clue)
Mapped the source control and local folder from scratch

You will have to change your workspace mapping. If the Source Control Explorer allows you, you can open the Workspace dropdown (in the toolbar) and edit the current mapping.
If the Source Control Explorer doesn't allow you due to Access Denied errors, you can also use the commandline utility tf.exe to remove them.
tf workspaces /remove
And then create a new one through the UI or also from the commandline using
tf workspace /new
tf workfold /map
I'm re-using an old picture here, step 4 should be to fix the paths in the Workspace folders list on the bottom of the dialog :).

This is still happening in 2022 and below are steps we have resolved this "Access Denied" in visual studio (2019 in our case) for Azure DevOps Server.
Open visual studio command line and run the command;
tf workspace /delete “WORKSPACE_NAME;OWNER”
Open folder C:\ProgramData\Microsoft Team Foundation Local Workspaces and delete anything folder inside
Verify C:\ProgramData\Microsoft Team Foundation Local Workspaces
folder has the user you are logged into the machine as full access
Go back into Visual Studio and reestablish your workspaces and
perform a get latest

Related

Visual Studio TFS Workspace Mapping Question

We use Azure DevOps for TFS here. This developer is receiving an upgraded workstation and is trying to setup her workspaces in visual studio. When she attempts to create a workspace on her new workstation she receives the error "The workspace XYZ already exists on computer OLD-PC".
I know I can do some hacky visual studio command prompt stuff to delete the old workspace mappings on the TFS server, but I was hoping to understand the error a bit better. Is she receiving this error because TFS workspaces mapped to a project must be unique in name? I was a bit confused why it would be giving an error for a workspace already existing on a different PC, I thought it would identify by the new PC name and workspace name and not cause an issue.
Any insight or general guidance on workspace mapping conflicts would be appreciated. I need to learn a bit more about how this works.
Thanks in advance!!!
Customer will encounter this error ‘workspace xyz already exists on computer abc’ when trying to create a new local workspace while the old workspace persists.
And testing in my side and found that TFS workspaces mapped to a project must be unique in name.
To resolve this issue, you could rename your new workspace or use the tf workspace command to delete other's old workspace. Make sure you have own manage other users workspace permission. Otherwise, you need to get your TFS administrator to delete the workspace if you have no access to the account. Just using below command.
tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT"
See: Visual studio alerts workspace already exists for more details.

TFS Project Deleted, how to upload code to new project

Somehow on my team's TFS server, one of our projects got deleted. The code is on my local machine though so I'm trying to get it reuploaded, but I'm running into issues getting it back on the server. I've recreated the project and given it the same name and Visual Studio seems to recognize that the new project I've created is connected to the Project I'm trying to upload as a result. The problem is that when I try to check in the version I have to the new project it throws a pile of errors because the files "does not exist at the specified version or you do not have permission to access it". Is there some way to force the upload so that the files are all on the server again?
First remove .* folder from your current working project.
Then go to Visual Studio
Open Team Explorer
Click On Manage Connection
Add your account If not added
Enter your tfs url
Select your TFS folder where you want to checked in your code.
Try to checked in your code.
Even though you have deleted the project on server side, all changes in TFS are non-destructive.
You could check this, just navigate to the Source Control –> Visual Studio Team Foundation Server section.
In that section is a check box that says "Show deleted items in the Source Control Explorer"
If you have recreated the project and given it the same name and want check in local code to TFS. This may cause some trouble.
Suggest you to permanently destroy the project in TFS using Destroy Command (Team Foundation Version Control)
tf destroy [/keephistory] <itemspec1>[;<versionspec>][<itemspec2>...<itemspecN>]
[/stopat:<versionspec>] [/preview] [/startcleanup] [/noprompt] [/silent] [/login:username,[password]] [/collection:TeamProjectCollectionUrl]]
After destroy the old project, then create a new project with the same name, add your local code to this project, finally check in pending changes.

Error trying to open project from VisualStudioOnline

I just started trying to use VSO for my test projects I work on at home. I think I've got that all configured up and working properly but now I'm looking to connect to VSO at work so that I can look at some of the sample code for use on my work projects. At work I'm connected to our enterprise TFS server.
What I tried was to open my VSO account and then I chose the project. From there I selected the open in Visual Studio option. That launched my local VS 2015 but then I got an error that I did not have access to my VSO account.
After doing some searching I saw where someone suggested to open the web browser inside of VS and connect. I went through those steps (open VS, Tools, Web Browser, VSO site, logged in, selected project, opened .sln file) and that opened the project in a separate instance of VS locally. I mapped the workspace to my local drive and did a Map & Get. This opened the project locally but it was not in Source Control (determined by the fact that there were no lock icons next to the files).
I was even able to open my local VS, choose the project, went to File | Source Control | Open from Server | saw and selected my VSO account | selected my the project and saw it get the files from the server. However, as soon as it tried to open the project after copying all the files I got the same "TF30063: You are not authorized to access VSOAccount\DefaultCollection".
Anyone have any suggestions on something I can try?
Try to connect to the project from "Team Explorer\Manage Connections\Connect to team project".
If it still does not work, try following actions:
Log out your account.
Clear IE Cookies.
Clear TFS Cache. The cache folder usually locates in C:\Users\\AppData\Local\Microsoft\Team Foundation. You may
see several folders like 3.0, 4.0, 5.0 in it. Clean the Cache folder
in these folders.
Go to Help/Register Product in Visual Studio and make sure the account you need to access the VSO account is listed under All Accounts.

Change TFS source control mapping in Visual Studio 2013

I have multiple solutions that were previously mapped to a hosted TFS. Their local mapping was defined as well and all the source code was up-to-date locally. I have since discontinued my TFS subscription and started using visualstudio.com as my TFS server.
I went into one of the solutions, deleted the *.vssscc files from the solution and the *.vspscc files from each nested project. When I open the solution in VS 2013, the output window gives me a message saying the the original TFS (unsubscribed now) is not available and that the solution is open offline.
As a result, when I choose the "Change source Control" option, it first asks me to log in to the old TFS whose credentials are no longer valid.
Furthermore, it tells me that the local directory I am trying to map to the new TFS is already mapped to the old TFS. How can I remove this mapping without having access to the old TFS?
Not sure if this works if you're offline, but you can remove the mapping by opening the Manage Workspaces area in Source Control Explorer (click on the ... option of the dropdown to the right of Workspace:)
Manage Workspaces -> Select your workspace -> Edit -> Remove or change your mapping.
It's probably easiest to remove the mappings using the commandline
tf workspaces /remove workspacename;owner /collection:http://urlto.old:8080/tfs/ProjectCollection
After removing the old workspace configuration for the current folder and mapping the folder to your new subscription, Visual Studio should prompt you to automatically update the solution bindings to the new server.
This will not delete your workspace from the server (which keeps track of the workspaces), but since you no longer have access to it, it should be enough to let your client forget the folder is mapped.
The answers here work when the old TFS server is available. Mine wasn't but has not been removed from the server list in VS. Removing that entry allowed me to remove the solution from source control entirely along with the mapping and add it to another source control server.

TFS in VS2010 "remembers" file system mappings for deleted server/workspace?

Using the TFS tools in VS2010, I had added a CodePlex server. I had mapped a project on there to a local path, say C:\MyProject Later, we moved the project to a dedicated TFS server, so I added a new TFS server, and deleted the CodePlex one. This in turn removed the "workspace" for it.
However, now if I try to map a project in the second TFS server to C:\MyProject, I get the error:
The path C:\MyProject is already mapped in workspace MY-MACHINE;SND\myCodeplexUserName [https://tfs.codeplex.com/tfs/tfs32]
If I go to File | Source Control | Workspaces... in VS, that CodePlex workspace is not listed (since I had deleted the TFS server reference)
Does anyone know of another way to remove the existing mappings?
Use the command line utility tf with the workspace and workspaces commands. You may also find the workfold command useful.
Open a Visual Studio Command Prompt and type:
tf help workspace
I had to do this the other day to delete all the workspaces for a collection that was moved to a different server. In my case, the command was tf workspace /delete /collection:<url>. Use tf workspaces to display all your current workspaces.

Resources