Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do I add a project to an existing solution?

To add an existing project to a solutionIn Solution Explorer, select the solution. On the File menu, point to Add, and click Existing Project. In the Add Existing Project dialog box, locate the project you want to add, select the project file, and then click Open. The project is added to the selected solution.

Can a Visual Studio solution contain multiple projects?

When you create a new project, Visual Studio creates a solution to contain the project. You can then add other new or existing projects to the solution if you want.

Should I put project and solution same folder?

Creating a Solution NET will create a new solution with the same name as the project, placing the solution files in the same directory as the project. Although this works fine for small projects, it isn't well suited to more complex applications.


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.


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


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


If you are on VS2019, try this:

All Languages - All Platforms - Other

screenshot


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: How to create Solution file with dotnet core CLI