.net - 从第 3 方源恢复 NuGet 包

标签 .net visual-studio mono nuget travis-ci

我尝试使用命令行 nuget 来恢复 NuGet 包,例如:

nuget restore BuptAssistant.sln

但我使用了 3rd NuGet 包源中的一些包。在 Visual Studio 中,我可以使用 Options - NuGet Package Manager - Package sources 在命令行中设置另一个包源,如何操作?

错误日志可见Travis CI

最佳答案

在与您的解决方案 (.sln) 相同的目录中创建一个 Nuget.Config 文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://www.nuget.org/api/v3/" />
    <add key="MyCustomSource" value="https://yournnugetserver.com/api/v3/" />
  </packageSources>
</configuration>

或者:

nuget sources Add -Name "MyCustomSource" -source https://yournnugetserver.com/api/v3/
nuget restore MySolution.sln

或者:

nuget restore MySolution.sln -source "https://www.nuget.org/api/v3;https://yournnugetserver.com/api/v3/"

关于.net - 从第 3 方源恢复 NuGet 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46010597/

相关文章:

c# - 一次有太多 Delegate.BeginInvoke 调用吗?

visual-studio - 如何使 Visual Studio 在 80 个字符处换行?

c# - 在 Travis CI 上使用 Mono 5.14.0.177、msbuild 15.0、nuget 4.7.1 构建失败,但在 VirtualBox 中无法重现

visual-studio - 在 Visual Studio 中,将 ARM 模板加载到 Visual Studio 中时如何看到大纲

c++ - 将整数读取和写入文件的程序

Ubuntu Console.ReadLine 上的 Monodevelop 不起作用

apache - 在 apache 中使用带有 ssl 的单声道

.net - 有没有办法在 Windows 控制台中编写希伯来语?

.net - 通过已建立的连接与防火墙后面的设备对话 - 如何?

c# - 与 PostgreSQL 连接的良好技术