当使用Nexus上的NuGet代理时,dotnet restore会失败。

12

我在内部网络上的Nexus(v3.9.0-01)上有一个NuGet代理。我没有自己填充本地Nexus存储库(也不知道是如何完成的或是否存在任何问题),但是我可以手动上传新软件包。构建发生在Bamboo代理上,无法连接到公共仓库。

由于处于隔离状态,因此必须使用--no-restore运行dotnet build/dotnet publish并使用dotnet restore $projectPath --source $localNexus --runtime win-x64来还原软件包。

软件包被还原得很好,直到NuGet.Frameworks.4.7.0。该软件包存在5个不同版本(据我所知是官方nuget仓库的精确副本),只是不存在纯4.7.0版本(官方仓库中也不存在)。然后,dotnet restore会产生以下输出:

build   20-Jun-2018 16:24:26    info :   GET https://nexus.***.***.***.au/repository/nuget.org-proxy/Microsoft.CodeAnalysis.Workspaces.Common/2.8.0
build   20-Jun-2018 16:24:27    error: The feed 'https://nexus.***.***.***.au/repository/nuget.org-proxy/ [https://nexus.***.***.***.au/repository/nuget.org-proxy/]' lists package 'NuGet.Frameworks.4.7.0' but multiple attempts to download the nupkg have failed. The feed is either invalid or required packages were removed while the current operation was in progress. Verify the package exists on the feed and try again.
build   20-Jun-2018 16:24:27    error:   Unable to find package 'NuGet.Frameworks.4.7.0'.

即使我使用dotnet add $projectPath package --source $localNexus 在运行 dotnet restore之前强制安装包,还是无法恢复操作。

注意:此软件包是我的项目中Microsoft.VisualStudio.Web.CodeGeneration.Design的依赖项。

可能相关:https://issues.sonatype.org/browse/NEXUS-6159(标记有不同的Nexus版本)

问题:

  • 为什么软件包恢复失败(即未拉取最合适的4.7.0-xxx)?
  • 这是由于某些Nexus怪癖吗?还是损坏的软件包?
  • 为什么手动使用dotnet package add添加有问题的软件包没有帮助?

1
代理存储库会在您从源存储库请求软件包时进行填充。您不能简单地向代理存储库上传新软件包 - 您需要一个托管存储库来完成这个操作。我怀疑您的NuGet客户端配置不正确。您能否展示一下您的Nexus NuGet存储库和NuGet配置? - Dawid Sawa
有任何解决方案吗?这里也遇到了同样的问题。 - DarthVader
我正试图配置我的项目以使用已经设置好的Nexus存储库。您能否指点我正确的方向,以便我能够实现这一目标? - Kai McKenzie
1个回答

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接