views:

703

answers:

8

I get this error when i try to load a VS 2008 project from TFS (Source control)

The project file has been moved renamed or not on your computer

After i click OK the project says "unavailable". What is the problem? how do i resolve this? i never had this problem before. Some blogs said to delete the .suo file. But i cant locate the .suo file. I deleted the entire project on my local computer so that the next time it opens it will create a new one, but i still get same error. any ideas?

+2  A: 

Try opening the .csproj or .vbproj instead of the .sln. What has probably happened is the .sln (solution) file has a absolute file reference (instead of a relative path) to the compoenent project(s). You may need to re-create the .sln, or hand-edit it.

Computer Linguist
i tried to open the .vbproj file and this is what i get."The selected file cannot be opened as a solution or project. Please select a solution file or a project file"also please put how to recreate the .sln file. I am new to this. thanks
sineas
A: 

Right click on the unavailable project and edit the project file ... chances are, you will find a hardcoded file path or a virtual one that does not match where you checked the project out to.

Kindness,

Dan

Daniel Elliott
dont have the Edit option. its only reload project, cut and remove.
sineas
+1  A: 

TFS works like most source control packages: It remembers what it has put on your computer so that when you "Get Latest" it only has to get the chnages since your last "Get" instead of having to get absolutely everything.

This has one caveat: If you delete or rename the local files on your disk, TFS won't know that you have done this, and it will still think they are where it left them.

If you then "Get Latest" it will not bother to update the missing files.

You are then likely to get all kinds of "missing file" errors, from TFS and any other tools that look for the files.

To get around it, you need to:

  • If you think you might have any changes in there that you don't want to lose, copy the source folder on your PC as a back up just in case!
  • Right click on the project (in Solution Explorer) or folder (in Source Control)
  • Choose "Get Specific Version" from the context menu
  • Choose to get the "Latest Version" and tick the option that says (something like) "force get of files already in your workspace", which tells TFS to forget about what it "knows" and get all the files again anyway.

If you have any locally-changed (writable) files, then be careful. There is a second option that will overwrite these, losing your changes. But you have the backup, so you should be safe. It's generally better to tick this option as well to make sure that all your source code is completely up to date. (But obviously only if you don't mind losing any local changes!)

When you OK, this will forcibly get all the files in the project to your local drive, and should correct the problem.

Jason Williams
i did "get specific version" and checked "overwrite all files even if local match server". no errors, but nothing came in. i checked from another computer and the project is in TFS and the other person can work fine on it.
sineas
BTW my local source folder is completely EMPTY. There is nothing in it. I deleted all files initially so that i could get all new ones. like opening a brand new project.
sineas
In that case, the next thing I would check would be your workspace mapping. In Team Explorer, double click the Source Control icon and at the top of the window that appears is a drop-down combo box. Drop this down and choose "add/edit workspaces". Edit your workspace and check that the TFS project containing your code has a corresponding folder on your local hard drive. And make sure you are looking at this folder when you try to load the solution. (Hint: Compare your setup to the other developer's which works to try to track down the source of the problem)
Jason Williams
A: 

Clear out your workspace mappings (File -> Source Control -> Workspaces). Edit the workspace and either clear out all the mappings (more repercussion) or find the one that's associated to this server path. Then open Source Control Explorer and remap. Double click the SLN in Source Control explorer and it should get latest. Not entirely sure what has happened or what state you managed to get into, but with this should get you moving again.

Ryan Cromwell
+2  A: 

Deleting the .suo file definitely does the trick. It is a hidden file in the same path as the .sln file

AngrySpade
+1. Very unfortunate error message -- it's actually *most* likely to arise when you've moved the files the "correct" way according to your SCC provider. (e.g. using 'tf rename' for TFS) Moving the project on disk w/o telling TFS, or forgetting to update a sln/csproj file, will result in different error messages in my experience. SUO files are opaque so you're left scratching your head until you do a tfpt treeclean / scorch.
Richard Berg
A: 

I found it easiest to create a new Solution sln file.

David
A: 

I ran into this issue and was able to resolve it by obtaining the .rptproj files from a co-worker and copying them into my local directory. The project was then able to re-load.

Sayward
A: 

Though it's well known VS defect, definately we can handle it!

  • Open the solution file in edit mode

  • Modify the relative path to match the modified/moved physical path ..

    SccProjectUniqueName1 = Source\\Order\\Order.csproj
    SccProjectName1 = Order.ApplicationService
    SccLocalPath1 = Order.ApplicationService
    
  • Also, makesure of correct relative path for the referring project(s)

    Project("{asdasd-301F-11D3-BF4B-asdasd}") = "Order",
            "Source\Order\Order.csproj", "{E25641BC-C990-40E2-8876-08AE8728F763}"
    EndProject
    
sandeept