简体   繁体   中英

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. The project looks like a class library project and it has one .csproj file and everything else is .cs files.

I am not sure how to open this project.

Any suggestions?

Double-click the .csproj file. Visual Studio will open the project file, regardless if it's not part of solution. A solution is not mandatory.

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

Microsoft has provided tool called 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.

Installation : open command prompt and run the below command.

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

Command to generate the sln file.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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