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

Visual StudioProjects and-Solutions

Visual Studio Problem Overview


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)?

Visual Studio Solutions


Solution 1 - Visual Studio

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.

Solution 2 - Visual Studio

For Visual Studio 2019 the steps are described in https://docs.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

Solution 3 - Visual Studio

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

Solution 4 - Visual Studio

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://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new

enter image description here enter image description here

Related SO: https://stackoverflow.com/questions/42927398/how-to-create-solution-file-with-dotnet-core-cli

Solution 5 - Visual Studio

If you are on VS2019, try this:

All Languages - All Platforms - Other

screenshot

Solution 6 - Visual Studio

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)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAllen RiceView Question on Stackoverflow
Solution 1 - Visual StudioJustin EthierView Answer on Stackoverflow
Solution 2 - Visual StudioMichael FreidgeimView Answer on Stackoverflow
Solution 3 - Visual StudioShawn McGoughView Answer on Stackoverflow
Solution 4 - Visual StudiosommmenView Answer on Stackoverflow
Solution 5 - Visual StudioNetguyView Answer on Stackoverflow
Solution 6 - Visual StudioRikouView Answer on Stackoverflow