I had a C# class library project as part of my solution. I later updated the root folder of the project. Since the solution was pointing to the wrong path, I had to "delete" the project and then re-add it. However, when I add the existing project, it says "The project file \myproject.csproj' has been moved, renamed or is not on your computer".
This is baffling because the .sln file has no reference to the project. (I checked the text contents) How does VS cache the project with it's old folder path? The solution is version controlled in TFS, but the mappings point to the new folder structure, so it's even more confusing as to where it's trying to get the old folder path from.
Edit: I checked the .csproj file, the .csproj.vspscc and none of them have a path variable in them. I have also tried deleting the .suo file.
To add an existing project to a solutionOn the File menu, point to Add, and click Existing Project. In the Add Existing Project dialog box, locate the project you want to add, select the project file, and then click Open. The project is added to the selected solution.
In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.
This has been a trouble with Visual Studio for years now. In such a case, deleting the hidden .suo file in the root folder and restart VS will reconstruct a proper .suo file and almost always eliminate the issue.
If you use TFS, take a look at Just TFS' comment in the original post to avoid this problem in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With