简体   繁体   English

c# 项目中没有 .sln 文件

[英]no .sln file in c# project

I want to open a project in Visual Studio 2012 and I am looking at the source folder, but it does not have a solution file.我想在Visual Studio 2012打开一个项目,我正在查看源文件夹,但它没有解决方案文件。 The project looks like a class library project and it has one .csproj file and everything else is .cs files.该项目看起来像一个类库项目,它有一个.csproj文件,其他所有文件都是.cs文件。

I am not sure how to open this project.我不知道如何打开这个项目。

Any suggestions?有什么建议?

Double-click the .csproj file. 双击.csproj文件。 Visual Studio will open the project file, regardless if it's not part of solution. Visual Studio将打开项目文件,无论它是否不是解决方案的一部分。 A solution is not mandatory. 解决方案不是强制性的。

如果没有.csproj文件并且您有“adduser.aspx.cs”文件,请打开VS->文件 - >打开 - >网站选项,然后从那里浏览到您的文件夹并打开打开解决方案的文件夹可以运行该项目。

Microsoft has provided tool called SlnGen. Microsoft 提供了名为 SlnGen 的工具。 You can use it to generate the solution file.您可以使用它来生成解决方案文件。 It's very simple to install and use.安装和使用非常简单。 It works pretty well with multiple projects as well.它也适用于多个项目。 Once the sln file is generated, you can open the project(s) using this sln file.生成 sln 文件后,您可以使用此 sln 文件打开项目。

Installation : open command prompt and run the below command.安装:打开命令提示符并运行以下命令。

dotnet tool install --global Microsoft.VisualStudio.SlnGen.Tool

Command to generate the sln file.生成 sln 文件的命令。

slngen --launch:false --folders:true --collapsefolders:true --solutiondir:src --solutionfile:MySolution.sln --ignoreMainProject --verbosity:normal **.csproj

You can find the documentation here and GitHub repo here .你可以找到的文件在这里和GitHub库在这里

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM