在原本的结构里面,由于默认服务引用的都是ABP原生的模块,所以结构目录里面没有包含modules目录,这里我们添加一个modules目录,用于存放我们的自定义模块。
在shared里面,我们再抽一个EventData的模块,用于消息队列共用数据实体。修改后结构如下图所示:
![](https://i-blog.csdnimg.cn/blog_migrate/47f4a447a7b919b62209531e02459e0b.png)
开始搭建#
由于我们没有商业版的代码生成器,那就纯手工搭建这个结构了。这里我们使用VS Code作为编辑器配合dotnet cli操作
创建新的空白解决方案,后续通过再VS来编辑解决方案的内容。
dotnet new sln -n FunShow
然后在解决方案目录下创建目录
创建Shared项目#
使用dotnet cli创建shared目录下的项目
dotnet new classlib -n FunShow.Shared.Hosting -f net7.0
dotnet new classlib -n FunShow.Shared.Hosting.AspNetCore -f net7.0
dotnet new classlib -n FunShow.Shared.Hosting.Gateways -f net7.0
dotnet new classlib -n FunShow.Shared.Hosting.Microservices -f net7.0
dotnet new classlib -n FunShow.Shared.Localization -f net7.0
dotnet new classlib -n FunShow.Shared.EventData -f net7.0
dotnet new console -n FunShow.DbMigrator -f net7.0
编辑.csproj文件#
FunShow.Shared.Hosting
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FunShow.Shared.Hosting</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Autofac" Version="7.0.0" />
<PackageReference Include="Volo.Abp.Data" Version="7.0.0" />
</ItemGroup>
</Project>
FunShow.Shared.Hosting.AspNetCore
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>FunShow.Shared.Hosting.AspNetCore</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.ElasticSearch" Version="8.4.1" />
<PackageReference Include="prometheus-net.AspNetCore" Version="4.1.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Swashbuckle" Version="7.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="7.0.0" />
<ProjectReference Include="..\FunShow.Shared.Hosting\FunShow.Shared.Hosting.csproj" />
</ItemGroup>
</Project>
FunShow.Shared.Hosting.Gateways
这里网关我们使用yarp
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Yarp.ReverseProxy" Version="1.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FunShow.Shared.Hosting.AspNetCore\FunShow.Shared.Hosting.AspNetCore.csproj" />
</ItemGroup>
</Project>