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

NU1102错误:找不到Communications.Interface 6.0.0版本包求助

解决NU1102找不到本地类库新版本的问题

原因分析

修改Communications.Interface的PackageVersion后,仅完成了类库的构建,但新版本的NuGet包并未被打包并发布到你的本地NuGet源(DotNetPackages),导致引用项目无法找到6.0.0版本。

解决步骤

  • 步骤1:生成新版本NuGet包
    右键解决方案中的Communications.Interface项目,选择【打包】,或者在终端执行命令:

    dotnet pack Communications.Interface.csproj -c Release
    

    执行完成后,项目的bin/Release目录下会生成Communications.Interface.6.0.0.nupkg文件。

  • 步骤2:推送新版本到本地NuGet源
    找到本地DotNetPackages源的路径,执行推送命令:

    dotnet nuget push "Communications.Interface.6.0.0.nupkg" --source "DotNetPackages"
    

    也可以直接将生成的.nupkg文件复制到本地NuGet源的目录中。

  • 步骤3:清理并还原引用项目的包
    在Communication项目的终端执行命令:

    dotnet clean
    dotnet restore
    

    之后重新构建项目即可。

额外优化建议

  • 在Communications.Interface的csproj文件中添加自动打包配置,每次构建时自动生成NuGet包:
    <PropertyGroup>
      <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    </PropertyGroup>
    
  • 确认本地NuGet源已正确注册,可通过命令查看:
    dotnet nuget list source
    
    若未注册,执行命令添加:
    dotnet nuget add source "本地DotNetPackages路径" --name "DotNetPackages"
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 20:00:56