我在 Ubuntu 14.04 上运行 .NET Core 1.1.0,目标是在 Ubuntu 上的 Docker 中托管我的 Web API。我想在 Ubuntu 上构建我的包,但一些 NuGet 引用托管在内部 NuGet 存储库 (Artifactory) 上。添加包源后,这在 Windows 上的 VS2015 中运行良好,但是当我运行时:
dotnet restore
在 Ubuntu 上,托管在公共(public) NuGet 存储库上的包下载正常,但 Artifactory 上的包下载失败:
error: Unable to resolve 'Mercury.BaseModel (>= 1.1.0)' for '.NETCoreApp,Version=v1.1'.
我在 \home\<user>\.nuget\NuGet\NuGet.Config
找到了一个 NuGet 配置文件并添加了 Artifactory 存储库,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Artifactory-DEV" value="https://theluggage-agct.gray.net/artifactory/api/nuget/nuget-institutional-development-local" protocolVersion="3"/>
</packageSources>
</configuration>
但我仍然遇到同样的错误。
安装 .NET Core SDK 后 NuGet 本身不起作用,我使用的是 dotnet restore
如前所述 - 我是否必须为 dotnet CLI 编辑类似的配置(必须使用 NuGet?)还是我需要做其他事情?
谢谢!
最佳答案
Dotnet CLI restore 可以将 -s 作为源提要 url,因此,如果您有带有远程存储库的 Artifactory 到 nuget.org。
dotnet restore -s https://artifactory.example.com/api/nuget/nuget.org
引用:
关于docker - 如何在 Ubuntu 14.04 上使用 dotnet CLI 注册新的 NuGet 包源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42207619/