docker - 如何在 Ubuntu 14.04 上使用 dotnet CLI 注册新的 NuGet 包源?

标签 docker asp.net-core nuget ubuntu-14.04 .net-core

我在 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/

相关文章:

jquery - 通过 Nuget 添加新版本的 Jquery 以及 t4mvc 的问题

linux - 在 192.168.65.1 :53: cannot unmarshal DNS message 上查找 google.com

postgresql - Golang 使用 SSL 证书连接到 Postgres

deployment - 如何在 Travis CI 中部署 nuget 包?

c# - 如何在ASP.NET 5 Web API和Entity Framework 7中设置 Multi-Tenancy ?

c# - ASP.NET 核心 2.1 : Navigating back to a page after an HTTP POST fails validation displays a browser error

c# - Nuget 和 "Unable to load the service index"

bash - Dockerfile 中 CMD ["bash"的作用

docker - 成为Docker容器中的root

c# - 命名空间 'Microsoft.EntityFrameworkCore' 中不存在“迁移”