Reputation: 3881
I'm not sure why, but Visual Studio is not showing all the projects in my solution. I need them to show so I can set as default project under solution explorer. I'm not seeing a fix for this issue in a general internet search. The closest I see is VS not showing files folders, but this is different than my issue. Hopefully there is an easy way to fix it, without adding things again piecemeal. My co-workers can see their complete set of projects in solution explorer so it must be a corruption in my workspace.
Upvotes: 21
Views: 77949
Reputation: 73
I think I found (part of) the problem and the solution, at least as far as I experienced it!
Most of the projects disappeared. Nothing of the above suggestions helped. I edited the solution file with Notepad and deleted manually all references to one of the projects that was not visible. I then added the project back from Visual Studio. (It didn't have to be closed, as it picked up the file change in the background and reloaded the solution.) My project became visible again. When I compared the solution file with what was before, I found out that the re-added project was missing from a section at the very bottom curiously titled:
GlobalSection(NestedProjects) = preSolution ...
Then I deleted the entire "nested projects" section. Voila! All the hidden projects are visible again.
I could not find what they were nested in before. None of the visible projects contained the "nested ones" in any way. They are surely in the dependencies of some of the visible projects, but you cannot work with them in the dependencies section.
Again, the solution was to edit the solution file with Notepad and delete the section about nested projects at the bottom.
Upvotes: 1
Reputation: 1
I had the same problem. Right click the Solution name in the Solution Explorer. Click Add > Existing Project... The Add Existing Project window will appear. Select the project file. It will be included in the solution.
click to see how to add the project file
Upvotes: 0
Reputation: 792
If the other solutions didn't work for you, then try this.
You can add the missing project to the solution file using the dotnet
command. To do so, go to the root folder of your project and run the following command from the terminal:
dotnet sln add ProjectLibrary/ProjectLibrary.csproj
The ProjectLibrary/ProjectLibrary.csproj
is the path to your missing project.
You can open the .sln
file to confirm if the prject has been added. You should see something like:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectLibrary", "ProjectLibrary\ProjectLibrary.csproj", "{F042B1DB-F887-44CC-941A-76569A86AF75}"
EndProject
Hope this helps.
Upvotes: 2
Reputation: 15
This .sln file structure breakdown offers a great insight on how projects are able to be found and populated into the project hierarchy. My .sln file had lost all its project persistence blocks and thus I had 0 projects under my solution. I copied the blocks from a a previous git commit and this fixed it. I still don't know why the blocks disappeared or the whole .sln file changed
Upvotes: 0
Reputation: 25
Upvotes: 0
Reputation: 91
I found that re-adding the existing project to the solution worked for me!
Upvotes: 7
Reputation: 11
I had the same issue. After opening the Visual Studio in Administrator mode it started to work.
Search for VS->Right click-> "Run as administrator"
Upvotes: -1
Reputation: 553
close vs , delete .vs folder then open vs again. it works for me.
Upvotes: 16
Reputation: 619
I had the same issue where my colleague saw 1 more project on his computer.
I deleted my .sln file and got the exact same version as he. Problem was still the same.
Solution was: I had an unloaded project. Apparently this is safed in a local user setting file (probably the .suo file). I looked for the unloaded project and loaded it again.
Upvotes: 1
Reputation: 361
Open your ".sln" project file using Notepad. In this file you can observe listed projects like below
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.myProject.Data", "test.myProject.Data\test.myProject.csproj", "{6D7F7B84-F3BD-4A19-A069-D144C345B887}"
EndProject
Please add if there any missing projects. If you have old back up or co-workers file, Just copy and paste missing projects to this file. In my case it works !!
Upvotes: 17
Reputation: 3881
I had to copy out changed files in my workspace, fix my permissions/ownership on my directory (it was no owner instead of me), re-do the mapped drive the workspace was on, re-do the shortcut to the Visual Studio project (even though it was supposed to theoretically be the same place I mapped), re-pull the project down, and copy my changes in again. At this point Visual Studio had the missing solutions in it again so I could set startup project and run the debugger. I'm not sure how the ownership/permissions got messed up. I think at one point the other office had a server go down, and maybe my permissions/ownership got mixed up then. I'm not sure why VS wasn't showing the missing projects, but it's fixed after doing the above.
Upvotes: 2