Microsoft Visual Studio解决方案(.sln) [英] Microsoft Visual Studio Solution (.sln)

查看:157
本文介绍了Microsoft Visual Studio解决方案(.sln)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从VS2008中的项目中丢失了Microsoft Visual Studio解决方案(.sln)文件.

I had lost my Microsoft Visual Studio Solution (.sln) file from my project in VS2008.

How can I reproduce?

推荐答案

打开VS2008>新>专案>其他项目类型> Visual Studio解决方案.然后从模板"选项卡中选择空白解决方案".复制您的项目文件夹,然后将其粘贴到新创建的解决方案项目文件夹中,位于新项目文件(.sln)的保存位置.然后在解决方案资源管理器中右键单击您创建的解决方案,选择添加现有项目"并浏览到新粘贴的项目文件夹,然后选择具有扩展名(.csproj)的文件.

您已经在项目中成功找到了丢失的(.sln)文件.
Open VS2008 > New > Project > Other Project Types > Visual Studio Solutions. Then select Blank Solution from Templates Tab. Copy your project folder and paste it to new created solution project folder, at the location where (.sln) files of new project saved. And then right click on your created solution in Solution Explorer, select Add Existing Project and browse to your new pasted project folder and select file having extension (.csproj).

You have successfully found your lost (.sln) file with your project.


这根本不是问题.相比之下,此文件中的信息很少到其他任何事情,您都可以很快地重新创建它.

只需使用Visual Studio创建一个空解决方案.检查文件是否放在正确的目录中. SLN的理想位置是在此解决方案下您需要拥有的所有项目文件(*.* proj,例如* .csproj)的位置都将放置在放置SLN文件的目录下的目录结构.如果您将新的SLN文件保存在错误的位置(很容易放错位置),请不要再次保存它.退出Visual Studio并手动将SLN文件移动到适当的位置会更容易.之后,单击此文件以再次加载Visual Studio.

您的解决方案文件已创建并放置在正确的位置.现在,您需要向其中添加所有项目文件.您可能想使用"Solution Explorer" =>来完善您的解决方案结构.您解决节点=> 添加" => 新解决方案文件夹".解决方案文件夹不会更改项目的目录结构,也不会影响项目的生成或运行时.使用"Solution Explorer" =>一个接一个地添加项目.您解决节点=> 添加" => 现有项目".

最后一步:通过主菜单检查项目依赖关系=>项目=> 项目依赖性...".当使用添加引用" =>添加引用时,如果您的项目使用项目引用相互引用(推荐),则无需执行此步骤. 项目".如果以这种方式进行引用,则将基于引用关系自动设置项目依赖关系,这些引用关系记录在项目中,而不是在解决方案文件中.

而已.有关项目结构,选项等的所有其他信息都保存在项目文件*.* proj中.希望您没有松开它们. :-)

主要建议:在没有版本控制系统的情况下停止任何开发!这些系统重量轻,免费且易于使用. 不要冒险对代码进行断言.

请参阅以下讨论:版本控制系统,有哪些可供选择? [ ^ ].

—SA
This is not a problem at all. There is so little information in this file compared to anything else, that you will re-created it very quickly.

Simply create an empty solution with Visual Studio. Check up if the file is placed in right directory. The perfect location of the SLN is where all the project files (*.*proj, for example, *.csproj) you need to have under this solution will go directory structure below the directory where your SLN file is placed. If you saved the new SLN file in a wrong place (which is very easy to misplace), don''t save it again. It''s easier to exit Visual Studio and move the SLN file in proper location manually. After that, click on this file to load Visual Studio again.

You solution file is created and placed in a right place. Now you need to add all project files to it. You may want to refine your solution structure down the road using "Solution Explorer" => you solution node => "Add" => "New Solution Folder". The solution folders will not alter the directory structure of your projects and won''t affect build or run-time of your projects. Add the projects one by one using "Solution Explorer" => you solution node => "Add" => "Existing Project".

Final step: check up project dependencies via Main Menu => Project => "Project Dependencies…". This step is not needed is your projects referenced each other using project references (recommended), when the references were added using "Add reference" => "Projects". If you made the references this way, the project dependencies will be set automatically based on referencing relationships, which are recorded in projects, not in the solution file.

That''s it. All other information on project structure, options, etc. is kept in project files *.*proj. Hope you did not loose them. :-)

Main recommendation: stop doing any development without Revision Control System! Those systems are light-weight, free of charge and easy to use. Don''t risk your code asserts.

See the following discussion: Revision control systems, which to choose from?[^].

—SA


这篇关于Microsoft Visual Studio解决方案(.sln)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆