159

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 is 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 can't 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.

2
  • 32
    Oh, how I hate TFS for giving me these headaches! Commented Sep 21, 2011 at 6:26
  • 2
    Go down, you will find correct answer here.
    – Claudius
    Commented Mar 8, 2016 at 13:16

18 Answers 18

292

What typically helps to fix it is deleting the Solution User Options aka "SUO".

VS up to 2013

In the older VS it is stored as a "hidden" SolutionName.suo in the same folder as the main .sln file.

VS2015 or later

In VS2015 the same data was moved to a "hidden" .vs folder under the same folder as the main .sln file.

10
  • 6
    +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. Commented Feb 26, 2010 at 20:32
  • 45
    Don't forget to restart Visual Studio after deleting the .suo file
    – orandov
    Commented Jun 11, 2012 at 13:45
  • 9
    Oh. So now the .suo file is hidden. Why? Oh, I know why. We are developers and are obviously not capable of handling the added complexity with seeing the .suo file out in the open ;-) Commented Aug 24, 2012 at 9:06
  • 30
    This also works in Visual Studio 2015, though the path to the .suo file has changed to <SolutionFolder>\.vs\<SolutionName>\v14\.suo.
    – Greg M.
    Commented Aug 31, 2015 at 14:22
  • 4
    I'm also using VS 2015. As Greg M. noted, the SUO file is now in a hidden folder called .vs within the solution folder. I was able to fix the error by closing VS, deleting the entire .vs folder and reopening VS.
    – ckkkitty
    Commented Jul 6, 2016 at 17:34
39

I just ran into this issue using VS 2013 after renaming a project. Stanley's answer guided me to the solution:

Close VS - delete .suo file - start VS again.

3
  • 1
    I could be wrong, but I don't think I even saw the .SUO file, until I closed VisualStudio.
    – Michael R
    Commented Feb 20, 2015 at 19:24
  • 7
    Just want to add - imperative that you close VS before deleting it. Deleting the file while VS is still open, then closing and reopening has NO effect. Must close first! Commented Nov 6, 2015 at 18:40
  • The above comment from @wizloc did it for me. To solve the problem for me, I had to close all open instances of VS (Visual Studio), before deleting the .suo file. When I deleted the .suo file with VS instances still open, closing and opening the solution did not solve the problem for me. Also, it's worth adding that I got this issue while trying to add a new project to my solution. Commented Sep 22, 2020 at 8:49
26

Delete the .suo file in a special way.

  1. Don't have the solution open when you delete the hidden .suo file.
  2. Restart VisualStudio.
  3. Open solution and Add project without error message.
1
  • 2
    Worked for me Visual Studio 2019. Only that you delete the hidden .vs folder
    – tinonetic
    Commented Apr 28, 2020 at 13:27
12

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.

3
  • 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
    Commented Jan 4, 2010 at 21:38
  • 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
    Commented Jan 4, 2010 at 21:44
  • 1
    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) Commented Jan 5, 2010 at 7:39
12

Easiest option worked out for me is:

  1. Right click the project & Remove the "not loaded" or "unavailable" project
  2. Right click the solution & Add "Existing Project"
4
  • I've tried this but still the same error, can't stand this stupid error (really a bug, I cannot accept this kind of nasty bug, extremely confusing).
    – Hopeless
    Commented May 29, 2019 at 20:32
  • 1
    Simple and straight... got it. Commented Jul 3, 2020 at 12:49
  • 1
    I faced this issue when I renamed one of the projects and the solution as well. The solution loaded fine along with all projects except the one I renamed. Performing this fixed the problem. Commented Feb 25, 2021 at 10:55
  • Thanks a lot! Only this answer fixed my issue. After performing these steps, project is loaded correctly but other projects that were referring this project were not working as expected. To make other projects work correctly, follow below steps: 1) Expand project that is not working correctly 2) Go to 'Dependencies' -> 'Projects' -> Right click the project that was reloaded -> Remove 3) Right click on 'Projects' -> 'Add Project Reference' -> Select the project that was removed in 2nd step -> 'OK'
    – Hemanth
    Commented Jun 28, 2023 at 14:15
10

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
    
7

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.

2
  • 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
    Commented Jan 4, 2010 at 20:44
  • Thanks! Opened the csproj files, on exit it asked to create/save a new .sln file and overwritten the old one!
    – Rafael
    Commented Jul 18, 2018 at 8:34
3

In my case, deleting the .suo file was insufficient. I discovered that my workspace configuration had an error. I discovered and resolved the problem with these steps:

  1. In Team Explorer, "Manage Workspaces..."

    enter image description here

  2. Click "Edit..."

    enter image description here

  3. Correct the value under "Local Folder"

    enter image description here

  4. Finally, delete the affected .suo files per the accepted answer.

2

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

1

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.

1

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.

1

I spent a lot of time for trying solve this problem. I did these steps : rename project, rename namespaces, rename project folder, edit .sln file, edit hidden .suo file. Project loaded but it was unrecognizable for TFS! Finally I found this guide.

If you're using Resharper and TFVC is your version control, follow these steps :

  • Right-click the project in Solution Explorer, select Rename, and enter the new name

  • Right-click the project again and select Properties. Change the "Assembly name" and "Default namespace" on the Application tab.

  • Right-click the project again and select Refactor -> Adjust Namespaces. Accept the changes.

  • Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs

  • Delete bin and obj directories in Windows Explorer

  • Open the Source Control Explorer and rename the project's directory. This will close the solution. Let it be closed.

  • Open the SLN file (with a text editor such as Notepad++) and change the path to the project (there should be multiple places).

  • Open the Solution again. Clean and Rebuild the project.

0

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

1
  • 2
    dont have the Edit option. its only reload project, cut and remove.
    – sineas
    Commented Jan 4, 2010 at 20:59
0

Solution for this

  1. Again rename the project folder
  2. Set specific version & force get in TFS
  3. remove read only & hidden option in the latest folder (not the rename one)
  4. Now you can open the project without any issues
0

Sometimes, even though you changed .sln and .csproj path, and manually rename, you might forget to check the folder name that contains the project.

0

It happened to me too. Apparently the csproj files were not checked in when I had created them in my old computer, and so when I downloaded the project from TFS in my new computer, the files were not there.

After checking them in using my old computer and getting them from TFS in the new computer, I succeeded in reloading the project.

0

In my case, because I modified .csproj file, it changed to .csproj.user .

I remove .user from the end of the file.

0

I got this issue while renaming the project name, all namespace names and reference project names. I fixed the issue by following:

  1. After renaming the project, delete all bin and obj folders and also .vs folder which is present in the same folder where .sln file is.
  2. Open .sln file in notepad and change the project names there as well.

Not the answer you're looking for? Browse other questions tagged or ask your own question.