Allen Rice
Allen Rice

Reputation: 19446

Is there any way to create a blank solution (.sln) file first and then add projects?

Visual studio has always annoyed me because (to my knowledge) you cannot create a solution first and then add new/existing projects to it. The only way I know how to create a solution is to create a project and specify the solution name for it.

So, is there any way to start with a blank solution (.sln) in visual studio (any version)?

Upvotes: 193

Views: 118955

Answers (12)

Xan-Kun Clark-Davis
Xan-Kun Clark-Davis

Reputation: 2843

Not really what OP is asking for, but might help someone, since it's so easy in VS2022.

Create a new (blank) solution (.sln) for an existing project (.csproj)

  1. Open the .csproj file
  2. "Save All"
  3. A dialog appears asking for the name and location of the newly generated solution file!

Upvotes: 0

agileDev
agileDev

Reputation: 441

You can do it from command line tool in Dot Net Core:

c:\[your path to source folder]> dotnet new sln --name MySol1

Upvotes: 0

Linus Kleen
Linus Kleen

Reputation: 34642

Thirteen years later. It's finally there. (Or: back. Since it's VS 2022)

enter image description here

Upvotes: 4

Mr. Squirrel.Downy
Mr. Squirrel.Downy

Reputation: 1177

A super easy way:
Create a text file with content:
(for vs 2012+)

Microsoft Visual Studio Solution File, Format Version 12.00

And save as .sln file.
You can open it as en empty solution now. And visual studio may will ask you to save the solution when you add new project in it, just cover it.

more sln header choose: https://gist.github.com/DanAtkinson/3f863464a5dadd93b8e4dea6fe7b973a

Upvotes: 1

ihsan güç
ihsan güç

Reputation: 281

visual studio 2022 red area needs to be marked.

enter image description here

Upvotes: 5

N_E
N_E

Reputation: 787

For Visual Studio 2019 and 2022, I found this solution to work.

Warning!

  1. You will have to re-signIn and Launch Visual Studio several times if you see anything abnormal (like i did).
  2. And Update Visual Studio Installer to re-download .Net core and other version frameworks

Source of Solution :Visual Studio Dev Comminity

Launch Command line and browse to devenv.exe

C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe 

launch executable with following argument: /resetuserdata

or copy paste full command here.

C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe /resetuserdata

Upvotes: 0

Rikou
Rikou

Reputation: 310

I fixed the missing "blank solution" problem in VS 2022 with Visual Studio Installer. My installer is not in english, so labels might be a little bit different. Sorry for my french english ;-)

In "Installation details", "Web dev with ASP.Net", "Optional", 8th checkbox "Items and projects templates for .Net Framework" (I can't imagine how this is related to the blank solution template... But i worked for me)

Upvotes: 11

sommmen
sommmen

Reputation: 7648

In my case, with Visual studio 2022 the empty project template was missing entirely:

enter image description here

However, dotnet comes to the rescue with this handy command:

dotnet new sln

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-new

enter image description here enter image description here

Related SO: How to create Solution file with dotnet core CLI

Upvotes: 54

Justin Ethier
Justin Ethier

Reputation: 134227

Yes, How to: Create Solutions and Projects gives an overview.

From the article:

Creating Solutions To create a new solution

  1. On the File menu, select New and then click Project.

  2. In the Project types pane, select Other Project Types and then select Visual Studio Solutions.

  3. In the Templates pane, select Blank Solution.

  4. Enter a name for the project.

  5. To change the location of the solution directory, choose Browse and specify a new location.

  6. Select Add to Source Control if you want to add the solution to a source control database or repository.

  7. Click OK.

After creating an empty solution, you can add new or existing projects and items to the empty solution by using the Add New Item or Add Existing Item command from the Project menu.

Upvotes: 295

Netguy
Netguy

Reputation: 91

If you are on VS2019, try this:

All Languages - All Platforms - Other

screenshot

Upvotes: 9

Michael Freidgeim
Michael Freidgeim

Reputation: 28473

For Visual Studio 2019 the steps are described in https://learn.microsoft.com/en-us/visualstudio/get-started/tutorial-projects-solutions?view=vs-2019#create-a-solution

  • Open Visual Studio.

  • On the start window, choose to Create a new project.

  • On the Create a new project page, enter blank solution into the search box, select the Blank Solution template, and then choose Next.

Note: You need to make sure you open a brand new project, right-clicking and create new project will not generate the option to create a blank solution.

enter image description here

Upvotes: 31

Shawn McGough
Shawn McGough

Reputation: 2040

For Visual Studio 2013, it has changed slightly.
Searching 'Installed Templates (Ctrl + E)' for 'Blank' works, too.

To create an empty solution

  1. On the File menu, click New and then click New Project.
  2. In the left pane, select Installed, select Other Project Types, and then s elect Visual Studio Solutions from the expanded list.
  3. In the middle pane, select Blank Solution.
  4. Set the Name and Location values for your solution, then click OK.

http://msdn.microsoft.com/en-us/library/zfzh36t7.aspx

Upvotes: 22

Related Questions