使用本地提要恢复 dotnet

Restore dotnet with local feed

我在 visual studio 2015 中有一个解决方案配置了本地 nuget 源 (C:\nuget.feed),它在 visual studio 2015 中工作,因为我配置了 nuget 存储库

但是当我想在 Jenkins 的构建抛出命令行上恢复时,我不知道如何指定本地提要。

我使用 dotnet restore 和 dotnet build 通过 asp net core 1.0 来做到这一点。

来自 dotnet restore documentation:

In order to restore the dependencies, NuGet needs the feeds where the packages are located. Feeds are usually provided via the NuGet.config configuration file. A default configuration file is provided when the CLI tools are installed. You specify additional feeds by creating your own NuGet.config file in the project directory.


You also specify additional feeds per invocation at a command prompt:

-s|--source <SOURCE>

Specifies a NuGet package source to use during the restore operation. This overrides all of the sources specified in the NuGet.config file(s). Multiple sources can be provided by specifying this option multiple times.

如果您对为什么 dotnet restore 不使用您的 VS 配置感兴趣,请查看 Nuget Config file locations and uses 部分。