netcore,设置类库在编译时,生成所有依赖的dll到目录下
在项目文件中增加配置:
<PropertyGroup> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> </PropertyGroup>
如:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> </PropertyGroup> <ItemGroup> <PackageReference Include="MySql.Data" Version="8.0.28" /> </ItemGroup> </Project>