visual-studio 有没有办法先创建一个空白的解决方案(.sln)文件,然后再添加项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3345742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there any way to create a blank solution (.sln) file first and then add projects?
提问by Allen Rice
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.
Visual Studio 一直让我很恼火,因为(据我所知)您不能先创建解决方案,然后再向其中添加新的/现有的项目。我知道如何创建解决方案的唯一方法是创建一个项目并为其指定解决方案名称。
So, is there any way to start with a blank solution (.sln) in visual studio (any version)?
那么,有没有什么办法可以从 Visual Studio(任何版本)中的空白解决方案 (.sln) 开始?
回答by Justin Ethier
Yes, How to: Create Solutions and Projects gives an overview.
是的,如何:创建解决方案和项目提供了概述。
From the article:
从文章:
Creating Solutions To create a new solution
On the Filemenu, select Newand then click Project.
In the Project typespane, select Other Project Typesand then select Visual Studio Solutions.
In the Templatespane, select Blank Solution.
Enter a name for the project.
To change the location of the solution directory, choose Browseand specify a new location.
Select Add to Source Controlif you want to add the solution to a source control database or repository.
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.
创建解决方案 创建一个新的解决方案
在文件菜单上,选择新建,然后单击项目。
在“项目类型”窗格中,选择“其他项目类型”,然后选择“ Visual Studio 解决方案”。
在模板窗格中,选择空白解决方案。
输入项目的名称。
要更改解决方案目录的位置,请选择Browse并指定一个新位置。
如果要将解决方案添加到源控制数据库或存储库,请选择添加到源控制。
单击“确定”。
创建空解决方案后,您可以使用“项目”菜单中的“添加新项目”或“添加现有项目”命令向空解决方案添加新的或现有项目和项目。
回答by Shawn
For Visual Studio 2013, it has changed slightly.
Searching 'Installed Templates (Ctrl + E)' for 'Blank' works, too.
对于Visual Studio 2013,它略有变化。
搜索“已安装的模板(Ctrl + E)”以找到“空白”也有效。
To create an empty solution
创建一个空的解决方案
- On the Filemenu, click Newand then click New Project.
- In the left pane, select Installed, select Other Project Types, and then s elect Visual Studio Solutionsfrom the expanded list.
- In the middle pane, select Blank Solution.
- Set the Nameand Locationvalues for your solution, then click OK.
- 在文件菜单上,单击新建,然后单击新建项目。
- 在左窗格中,选择Installed,选择Other Project Types,然后从展开的列表中选择Visual Studio Solutions。
- 在中间窗格中,选择空白解决方案。
- 为您的解决方案设置Name和Location值,然后单击OK。
回答by Michael Freidgeim
For Visual Studio 2019the steps are described in https://docs.microsoft.com/en-us/visualstudio/get-started/tutorial-projects-solutions?view=vs-2019#create-a-solution
对于Visual Studio 2019,步骤在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.
打开 Visual Studio。
在开始窗口中,选择 Create a new project。
在“新建项目”页面的搜索框中输入空白解决方案,选择“空白解决方案”模板,然后选择“下一步”。
注意:您需要确保您打开了一个全新的项目,右键单击并创建新项目不会生成创建空白解决方案的选项。

