-1

When I clone the repo I want to add a C# project in visual studio. But I cant seem to build the project, since its not in a solution folder. How can I add an Solution folder to an already existing git repo consisting of some projects?

Kai
  • 21
  • 2
  • Why do you need a folder? I'm really not clear what you are asking here. Perhaps speak to the person who made the repo, maybe they just forgot to include the sln file. – DavidG Mar 23 '21 at 13:38
  • Can you share the build error you are seeing? It should not be related to a missing sln file but we can discover it – Jorge Cupi Mar 23 '21 at 13:45
  • Make Sure, Your Visual Studio Project and project cloned from Git are same. Mostly It happens – Allahbakash.G Mar 23 '21 at 16:21

1 Answers1

1

If your file structure is like:

.git/
Project1/Project1.csproj
Project2/Project2.csproj

You go to the project root, and run the following in your powershell prompt:

# Create a new solution file
dotnet new sln

# Add all csproj files to it
dotnet sln add (Get-Item **/*.csproj)

You may now open the *.sln file directly within visual studio.

galdin
  • 12,411
  • 7
  • 56
  • 71