【问题标题】:Restore NuGet package from 3rd party source从 3rd 方源恢复 NuGet 包
【发布时间】:2017-09-02 04:53:30
【问题描述】:

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

nuget restore BuptAssistant.sln

但我使用了来自第三个 NuGet 包源的一些包。在 Visual Studio 中,我可以使用Options - NuGet Package Manager - Package sources 设置另一个包源,在命令行中,怎么做?

错误日志可见Travis CI

【问题讨论】:

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


    【解决方案1】:

    在与您的解决方案 (.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/"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多