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

拟墨画扇 提交于 2021-01-20 16:44:28

问题


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. How should I open such a project in Visual Studio?


回答1:


If a *.csproj file exists, you can build a new solution by Visual Studio at first. Next, you can open this *.csproj file in Visual Studio.




回答2:


If you have a web project (without a .sln), you must do:

Menu FileOpenWeb Site...

And choose the folder where the project is.




回答3:


An even simpler way in Visual Studio is to follow this:

Menu FileNewProject from existing code

Choose the source file location and a .csproj and .sln file is created.




回答4:


The simplest way to do this (assuming this is not a web project, as indicated in another answer) would most likely be to:

  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.



来源:https://stackoverflow.com/questions/17713037/how-do-i-open-a-project-without-a-sln-file-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!