简体   繁体   English

如何在Visual Studio中打开没有.sln文件的项目?

[英]How do I open a project without a .sln file in Visual Studio?

I was writing this program all in Vim and now I'm thinking of moving to Visual Studio, but since I didn't start in Visual Studio in the first place, there is no .sln file to open from. 我正在Vim中编写这个程序,现在我正在考虑迁移到Visual Studio,但由于我首先没有在Visual Studio中启动,所以没有.sln文件可以打开。 How should I open such a project in Visual Studio? 我应该如何在Visual Studio中打开这样的项目?

If you have a web project (without a .sln), you must do: 如果您有一个Web项目(没有.sln),您必须:

Menu FileOpenWeb Site... 菜单文件打开网站...

And choose the folder where the project is. 并选择项目所在的文件夹。

If a *.csproj file exists, you can build a new solution by Visual Studio at first. 如果存在* .csproj文件,则可以首先使用Visual Studio构建新的解决方案。 Next, you can open this *.csproj file in Visual Studio. 接下来,您可以在Visual Studio中打开此* .csproj文件。

The simplest way to do this (assuming this is not a web project, as indicated in another answer) would most likely be to: 最简单的方法(假设这不是一个Web项目,如另一个答案中所示)最有可能是:

  1. Create a new project (of the desired type), which should also create the solution for it to live within. 创建一个新项目(所需类型),该项目还应该为其生成一个解决方案。
  2. In the solution explorer, right click and select "Add > Existing item..." 在解决方案资源管理器中,右键单击并选择“添加>现有项...”
  3. Insert all individual files that belong in this new project. 插入属于此新项目的所有单个文件。

It's probably also worth noting that it's a good idea to double check the project setting, namespaces, etc. before you get too far with building up your project to avoid potential issues later. 可能还值得注意的是,在您构建项目以避免潜在问题之前,仔细检查项目设置,命名空间等是个好主意。

An even simpler way in Visual Studio is to follow this: Visual Studio中更简单的方法是遵循以下方法:

Menu FileNewProject from existing code 菜单文件新建现有代码中的项目

Choose the source file location and a .csproj and .sln file is created. 选择源文件位置,然后创建.csproj和.sln文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何配置.sln Visual Studio Project文件存储在项目文件夹中? - How to configure .sln Visual Studio Project file to be stored in the project folder? 如何在 Visual Studio 中打开 C++ 项目文件夹? - How do I open a c++ project folder in visual studio? 如何使用所选项目构建visual studio解决方案文件.sln命令行 - How to build visual studio solution file .sln command line with selected project 如何创建Visual Studio解决方案文件(.sln)并添加更多项目 - How do you create a Visual Studio Solution File (.sln) and add more projects 如何在Visual Studio 2010 Professional中打开Visual Studio 2010 Express项目? - How do I open a visual studio 2010 express project in visual studio 2010 professional? 如何在Visual Studio 2010中更改.sln文件的默认位置? - How to change default location of .sln file in Visual Studio 2010? 使用cmake生成Visual Studio sln项目,而不链接到原始CMakeFiles.txt - Use cmake to generate Visual Studio sln project without link to original CMakeFiles.txt 如何在没有Blend的情况下在Visual Studio 2010中打开Blend 4项目 - How to open a blend 4 project in Visual Studio 2010 without having Blend 为什么我的生成的.sln文件不会在Visual Studio 2010中打开? - Why won't my generated .sln file open in Visual Studio 2010? 如何在Visual Studio中构建多项目解决方案而不会在二进制文件之间存在依赖关系? - How do I build a multiple project solution in Visual Studio without dependencies between the binaries?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM