使用命令行搭建标准AspNetCore项目

2020-11-12  本文已影响0人  AlexWillBeGood

使用命令行搭建AspNetCore项目手速度更快一点,而且能够更清楚项目结构以及相互间的引用关系。这里是按照ABP框架推荐的结构来搭建的项目。

搭建好后目录结构为:


image.png
dotnet new sln
dotnet new gitignore
mkdir src
cd src 
dotnet new webapi --name DataTransfer.HttpApi.Host --no-https
dotnet new classlib -f netcoreapp3.1 --name DataTransfer.Application
dotnet new classlib -f netcoreapp3.1 --name DataTransfer.Application.Contracts
dotnet new classlib -f netcoreapp3.1 --name DataTransfer.Domain
dotnet new classlib -f netcoreapp3.1 --name DataTransfer.Domain.Shared
dotnet new classlib -f netcoreapp3.1 --name DataTransfer.EntityFramework
dotnet new classlib -f netcoreapp3.1 --name DataTransfer.EntityFramework.DbMigrations
dotnet new classlib -f netcoreapp3.1 --name DataTransfer.Infrastructure
dotnet sln add src/DataTransfer.HttpApi.Host
dotnet sln add src/DataTransfer.Application
dotnet sln add src/DataTransfer.Application.Contracts
dotnet sln add src/DataTransfer.Domain
dotnet sln add src/DataTransfer.Domain.Shared
dotnet sln add src/DataTransfer.EntityFramework
dotnet sln add src/DataTransfer.EntityFramework.DbMigrations
dotnet sln add src/DataTransfer.Infrastructure

cd src
cd DataTransfer.HttpApi.Host
dotnet add reference ../DataTransfer.Application
dotnet add reference ../DataTransfer.Domain
dotnet add reference ../DataTransfer.EntityFramework
dotnet add reference ../DataTransfer.EntityFramework.DbMigrations

cd ../DataTransfer.Application
dotnet add reference ../DataTransfer.Application.Contracts
dotnet add reference ../DataTransfer.Domain
dotnet add reference ../DataTransfer.EntityFramework

cd ../DataTransfer.Application.Contracts
dotnet add reference ../DataTransfer.Domain
dotnet add reference ../DataTransfer.Domain.Shared

cd ../DataTransfer.Domain
dotnet add reference ../DataTransfer.Domain.Shared

cd ../DataTransfer.EntityFramework
dotnet add reference ../DataTransfer.Domain

cd ../DataTransfer.EntityFramework.DbMigrations
dotnet add reference ../DataTransfer.EntityFramework
上一篇下一篇

猜你喜欢

热点阅读