You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET Framework迁移.NET 6 Core遇CS1705版本冲突求助

解决.NET 6迁移中CS1705程序集版本冲突问题
  • 排查依赖链:在终端运行 dotnet list AdditionnalDataManagerAPI package,查看所有直接和传递依赖的版本,定位哪个包引入了8.0.0.0版本的Microsoft.Extensions.DependencyInjection.Abstractions。
  • 强制统一版本:在AdditionnalDataManagerAPI项目的.csproj文件中,直接添加该包的指定版本引用并开启自动绑定重定向:
    <ItemGroup>
      <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
    </ItemGroup>
    <PropertyGroup>
      <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
      <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    </PropertyGroup>
    
  • 清理重建项目:手动删除项目根目录下的bin和obj文件夹,依次执行 dotnet clean、dotnet restore、dotnet build 命令彻底重建。
  • 同步类库版本:检查Application类库项目的.csproj文件,确认它引用的Microsoft.Extensions.DependencyInjection.Abstractions版本。如果类库用的是8.0,要么把API项目升级到.NET 8(兼容.NET 6代码),要么把类库的该包版本降级到7.0,保持版本一致。
  • 清空NuGet缓存:运行 dotnet nuget locals all --clear 清空本地NuGet缓存,避免旧缓存干扰依赖还原。

内容的提问来源于stack exchange,提问作者belgacem aymen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 23:53:25