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

11

186

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

Adulterate answered 27/7, 2010 at 16:27 Comment(2)
I missed the "Blank Solution" option in VS2022, however, I fixed it by modifying my installation and adding a few other components/workloads. I guess the option that I added that might have been the one that fixed it is the ".NET 5.0 Runtime".Obadias
I too had this problem and I can confirm that the .NET 5.0 Runtime component restores the Blank Solution template.Lashonda
A
282

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.

Antipasto answered 27/7, 2010 at 16:29 Comment(8)
Thanks Justin, this helped me in 2017 too ! Don't know why they want to hide the blank/empty solution into such obscure place when many of us wants to start with blank solution and create folder structure as per tiers...ThanksCaspar
Visual Studio 2019 does not allow you to create new projects via Add-new-Item. However you can add a new project via File->New->Project and type "project" after the word new on the control line.Lyons
awesome - search for "solution" and you find nothing.... thanks for provide workaround for microsoft fails :)Caracal
Searching for "solution" will only return the 'blank solution' template when the language dropdown is set to 'All Languages'. This is dropdown is defaults to the last used selection (usually 'C#')Adham
still help me in 2021, a new blank solution help me only touch 3/51 csproj in my project, so I don't need to wait 30 min every time I hit F5 :DInextricable
Link is broken in August 2021 - Here is the new link - learn.microsoft.com/en-us/visualstudio/ide/…Maund
Thanks @BrendanSluke just updated the answer to use your link.Antipasto
Also works on VS2022. However the language must be set in English on first try. After creating one using English, it can be accessed when using other languages (Korean in my case).Sholapur
R
50

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

Renteria answered 10/12, 2021 at 13:39 Comment(1)
This is the correct answer for Visual Studio 2022.Baste
M
31

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

Mickelson answered 15/9, 2019 at 1:51 Comment(7)
This doesn't seem to work any more, at least not for me. There is no Blank Solution in the list any more, either from File > Create New Project or via the Start window...Unclinch
there is no 'blank solution' optionAdmissible
@Bassie, I've added an image, that is available on my machineMickelson
@MichaelFreidgeim I wonder if this is something that needs to be added via the vs installer?Admissible
@Admissible I had the same problem. I could not find it by searching. But if I select All languages, All platforms and Other, the Blank Solution appears in the list.Kermitkermy
@VegardInnerdal - to make it even more amusing, you need to leave the search box blank too. If you set All languages, All platforms and Other, and have a search of "Blank" or "Solution" the "Blank Solution" doesn't appear!Nonce
+1 for the note. Yes it definitely work if you 1) open visual studio 2) 'select create new project' option. It doesn't work if you start visual studio without code and select New project from file menu.Bullis
T
22

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

Tamqrah answered 10/3, 2014 at 16:11 Comment(4)
For me it was Installed > Templates > Visual Studio Solutions > Blank SolutionLotus
+1 Been banging my head into a wall trying to find the blank solution option and searching for "Blank" worked.Gelation
For me it was Installed > Templates > Other Project Types > Visual Studio Solutions > Blank SolutionDrogue
You can get Blank Solution on Visual Studio 2019 via File->New->Project and type the word"solution" after the word "new" on the control line.Lyons
C
11

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)

Clemenciaclemency answered 30/1, 2022 at 16:3 Comment(3)
This worked for me too. It wasn't the 8th checkbox though, for me it was just the one labelled Additional project templates (previous versions).Enthrone
Just ran into this today, never ran into it before so I was totally lost.. thank you to Rikou and @Enthrone this was exactly my issue. Installing the "Additional project templates (previous versions)" option added it back in for me.Accelerate
This fix the same problem for me. I also was "Additional project templates (previous versions)" checkboxBerners
Z
9

If you are on VS2019, try this:

All Languages - All Platforms - Other

screenshot

Zibet answered 14/5, 2021 at 1:52 Comment(4)
Hi There, Link based answers could be made as comments for quicker reach.Thaliathalidomide
This should be the new answer. Not sure why they removed the ability to search for blank solution. Seems very counter-intuitive.Rubefaction
Thanks! This is the right answer :)Mokas
Couldn't find it in VS 2022. At least it worked from cmd.Lodie
S
5

visual studio 2022 red area needs to be marked.

enter image description here

Sidecar answered 28/1, 2023 at 8:43 Comment(2)
Can confirm this worked for me in VS 2022!!Blowfish
Sometimes works Sometimes doesn't works but I did and it worked me. Second İf doesn't work you can add VS 2019 after that you can use.Nanoid
C
1

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

enter image description here

Clingstone answered 9/11, 2023 at 0:3 Comment(0)
H
0

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
Hoem answered 15/7, 2022 at 1:26 Comment(0)
F
0

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

Fremantle answered 13/3, 2023 at 2:50 Comment(0)
D
0

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

c:\[your path to source folder]> dotnet new sln --name MySol1
Dolan answered 4/12, 2023 at 6:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.