我尝试使用命令行 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/