简体   繁体   中英

Restore NuGet package from 3rd party source

I tried to use command-line nuget to restore NuGet package, like:

nuget restore BuptAssistant.sln

But I used some packages from 3rd NuGet package source. In Visual Studio, I can use Options - NuGet Package Manager - Package sources to set another package source, in command-line, how to do it?

Error log can be seen in Travis CI

Create a Nuget.Config file in the same directory as your solution ( .sln ):

<?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>

Or:

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

Or:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM