Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to organize multiple projects in an ASP.NET CORE solution like DDD?

How to create a solution of .net core? For example: 1 Web Project 3 Lib Projects

How to create it without Visual Studio?

Using VS Code or Sublime Text?

like image 217
Dionny Prensa Avatar asked Dec 06 '25 06:12

Dionny Prensa


1 Answers

If you have dotnet core installed just create a root folder for your solution. Then open terminal in root folder and type for a mvc project:

dotnet new mvc -o SolutionName.Web

remember -o parameter creates a folder for new project and if it was -n project was going to be created in the folder you are in.

and for class library project

dotnet new classlib -o SolutionName.Library

cd SolutionName.Web

this line to add reference to use this library.

dotnet add reference ../SolutionName.Library/SolutionName.Library.csproj

get to root folder again

cd..

dotnet new sln -n SolutionName

we talked about -n. After we created solution we will add projects to solution.

dotnet sln add SolutionName.Web/SolutionName.Web.csproj

dotnet sln add SolutionName.Library/SolutionName.Library.csproj

dotnet build

if you are using vs code just type

code .

in the root of solution in terminal and you will start coding.

like image 64
Burk Avatar answered Dec 07 '25 20:12

Burk