Is there any way to create a blank solution (.sln) file first and then add projects?
Visual StudioProjects and-SolutionsVisual 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.
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
- On the File menu, click New and then click New Project.
- In the left pane, select Installed, select Other Project Types, and then s elect Visual Studio Solutions from the expanded list.
- In the middle pane, select Blank Solution.
- Set the Name and Location values for your solution, then click OK.
Solution 4 - Visual Studio
In my case, with Visual studio 2022 the empty project template was missing entirely:
However, dotnet comes to the rescue with this handy command:
dotnet new sln
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new
Related SO: https://stackoverflow.com/questions/42927398/how-to-create-solution-file-with-dotnet-core-cli
Solution 5 - Visual Studio
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)