Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Files could not be found in workspace

Tags:

I am using Visual Studio 2010 professional with TFS as a source control and everything was working fine. In morning I came I opened my solution and it opened as Offline. I tried going online, and it says

"Workspace for this solution could not be found." 

(I don't remember the exact error sentence).

I closed my solution. I went to pending changes window -> workspace ComboBox -> manage workspace. I edited my workspace and mapped my solution to the already existing folder.

Now I was able to see my pending changes in the window. I opened my solution again. I tried checking out a file, and I got error:

"file could not be found in workspace, or you don't have permission to access the file."

Any pointers for this except taking the latest version or the specific version. In manage workspace, my workspace was private.

like image 867
Sandy Avatar asked Jul 23 '12 08:07

Sandy


People also ask

Could not be found in your workspace or you don't have permission?

In Visual Studio's Source Control Explorer, right-click on a folder or item and select "Get latest version". If your workspace doesn't have that item mapped, it will ask you where you want it to be located on disk and then retrieve it for you. Hope this helps!

How do I add files to my Vscode workspace?

Drag a folder to the File Explorer to add it to the current workspace. You can even select and drag multiple folders. Note: Dropping a single folder into the editor region of VS Code will still open the folder in single folder mode.

What is a workspace folder?

A workspace is how Visual Studio represents any collection of files in Open Folder, and it's represented by the IWorkspace type. By itself, the workspace doesn't understand the contents or features related to files within the folder.


2 Answers

Sorry for bothering everyone. In the end I took the latest version to solve the issue.

like image 115
Sandy Avatar answered Sep 25 '22 02:09

Sandy


TFS works with a cache. There is one on your client computer that might be all kinds of confused, so delete the files in it. The default path to it is C:\Users\<Username>\Local Settings\Application Data\Microsoft\Team Foundation\<Version Number>\Cache (This can vary depending on your operating system, but it is in your profile).

You can try to re-establish the solution's/project's bindings by going to File -> Source Control -> Change Source Control... (If this menu item is missing it may mean that you need to reset your menu items). If the source files are already in a workspace, then you can click the Bind icon in the toolbar on the resulting dialog to re-link the file to source control. However, you may still need to perform a get or re-open VS to get it to stop complaining.

I know you mentioned wanting to know if you can do anything except Get Latest version, but TFS 2010 stored the workspace information on the server and needs to connect to re-establish the meta-data. It sounds like you essentially re-created the mappings for your workspace. In doing so the server needs to re-establish the connection. I think the only way to handle this is to perform a get after establishing the workspace. You should not lose anything unless you use the Get Specific Version dialog, but to be safe I would copy your files off to a temporary location before you perform the Get Latest in that workspace regardless. After you perform a Get Latest operation, everything should be fine.

Obviously, you may also want to check your permissions on the folder that the workspace is mapped to (I could not find the exact requirements after searching around a little bit). It is unlikely this is the problem as you seem to know, but if you are unsure then of course you can set the folders you are saving the files to so that your user account has FULL permissions to them recursively and see if that makes a difference.

Also, please ensure you have Visual Studio 2010 SP1 installed.

The behavior is improved in Visual Studio and TFS 2012 with what is called Local Workspaces; With Local Workspaces the meta-data about your files is stored in the filesystem instead of at the server. TFS 2012 should be on the market very soon.

like image 23
Ryan Riehle Avatar answered Sep 22 '22 02:09

Ryan Riehle