美文网首页
使用命令行搭建标准AspNetCore项目

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

作者: AlexWillBeGood | 来源:发表于2020-11-12 13:41 被阅读0次

    使用命令行搭建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
    

    相关文章

      网友评论

          本文标题:使用命令行搭建标准AspNetCore项目

          本文链接:https://www.haomeiwen.com/subject/nbfpbktx.html