Home
/
Blogs
/
Create a blank C# solution and add projects to it using command line

Create a blank C# solution and add projects to it using command line

April 01, 2024, Abdush Miah

Prefer to watch instead? Click below to watch the steps instead:

Step 1

Launch your terminal and create your solution

dotnet new sln -o MyAmazingProject

Step 2

Change directory into your newly created folder e.g:

cd MyAmazingProject

Step 3

Now inside of your solution create a new class library project

dotnet new classlib -o MyAmazingProject.DataAccess

Step 4

Now inside of your solution create a new console application project

dotnet new console -o MyAmazingProject.ConsoleApp

Step 5

Next add/associate those new projects with your solution using the below command:

dotnet sln MyAmazingProject.sln add ./MyAmazingProject.ConsoleApp

References

https://stackoverflow.com/questions/36343223/create-c-sharp-sln-file-with-visual-studio-code