29

I have a solution that contains few projects. The problem is that when I want to open just one of the projects by clicking on the specific .csproj file, it opens all the solution.

How can I open just one project?

Thanks.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Itay.B
  • 3,991
  • 14
  • 61
  • 96

6 Answers6

34

You can create a new solution, and add this project to the solution. Then this project will have a solution of it's own.

0x26res
  • 11,925
  • 11
  • 54
  • 108
  • 26
    Took me a few minutes to find out how to create a blank solution. For anyone else, in VS 2013 it's New Project -> Installed -> Other Project Types (expand rather than select) -> Visual Studio Solutions -> Blank Solution. – Giles Dec 11 '14 at 09:31
  • 2
    If using the cli: `dotnet new sln` > `dotnet sln add PROJECT_NAME` – Chris Owens Dec 09 '20 at 21:47
10

It's a hack but rename the .sln file to some other extension temporarily, then double click the csproj. Visual Studio seems to have intellismarts about detecting solutions.

Jafin
  • 4,153
  • 1
  • 40
  • 52
1

The only way I have been able to do this is to remove the project from the main solution and save it and close it.

You should now be able to open the solution and the project file independently.

Note: opening the csproj file will create a new solution for you.

Sam Hanley
  • 4,707
  • 7
  • 35
  • 63
1

Why do I want to open a single project from a solution? I have a solution with 66 subprojects, so it is helpful if you can only edit a single project. I have already tried many possibilities, as described above. Today I mostly do it with the command "Scope to this" in the project explorer. So I have the focus only on one project. So I hope this tip was helpful for you :-)

Franz
  • 77
  • 1
  • 4
-1

Depending on your needs. I just want to open the project so I copied the projectfolder to a temp folder and then I just open the project. But I don't want it in version control and all edits will be lost unless overwrite to the original folder.

Tomas Hesse
  • 385
  • 3
  • 10
-3

You can't. The basic unit of Visual Studio is a solution.

Christian Studer
  • 24,947
  • 6
  • 46
  • 71
  • 1
    You can have projects independent of solution files. I.e. no solution file at all. Yes, the "Solution Explorer" will still look like there is a solution whether you have a solution file or not, but it doesn't really mean anything with out the file. But you did not answer what Itay.B was asking. He was asking how to open a project separately from a solution it was already part of. –  Aug 01 '16 at 13:01