Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 501
Lost Avatar asked Oct 29 '25 22:10

Lost


2 Answers

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.

like image 120
Jason Evans Avatar answered Nov 01 '25 11:11

Jason Evans


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.

like image 41
vivek nuna Avatar answered Nov 01 '25 11:11

vivek nuna



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!