【发布时间】:2021-07-25 05:57:26
【问题描述】:
我已将 NuGet 包(BuildingBlocks)发布到 Github 包。我使用 nuget.config 文件为我的项目指定 nuget 源,以及我的包的凭据(凭据故意替换为占位符):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="github" value="https://nuget.pkg.github.com/<username>/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="<username>" />
<add key="ClearTextPassword" value="<password>" />
</github>
</packageSourceCredentials>
</configuration>
当我在我的 Fedora 机器上本地运行 dotnet restore 时,它工作正常。但是,当我尝试在派生自 mcr.microsoft.com/dotnet/sdk 映像的 Docker 容器中恢复包时,恢复失败并出现以下错误:
Determining projects to restore...
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.Annotations. No packages exist with this id in source(s): github, nuget
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.Localization. No packages exist with this id in source(s): github, nuget
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.IoC. No packages exist with this id in source(s): github, nuget
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.Nullability. No packages exist with this id in source(s): github, nuget
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.Domain. No packages exist with this id in source(s): github, nuget
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.Commands. No packages exist with this id in source(s): github, nuget
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.Option. No packages exist with this id in source(s): github, nuget
/app/src/DocumentService.Application/DocumentService.Application.csproj : error NU1101: Unable to find package BuildingBlocks.Queries. No packages exist with this id in source(s): github, nuget
我的 BuildingBlocks 包没有诸如 Annotations 和 Localization 之类的命名空间,所以我不知道为什么 dotnet CLI 会将这些写入输出。有没有人知道如何解决这个问题,或者为什么会发生?
【问题讨论】:
标签: asp.net-core .net-core nuget nuget-package-restore dotnet-cli