在使用VS 2017中的msbuild 15.0时,是否可以指定私有NuGet Feed服务器?我当前正在使用以下PowerShell命令:
&$msbuild /t:restore /tv:15.0 /t:Rebuild /p:Configuration=Release
默认情况下,仅获取nuget.org的源。
在使用VS 2017中的msbuild 15.0时,是否可以指定私有NuGet Feed服务器?我当前正在使用以下PowerShell命令:
&$msbuild /t:restore /tv:15.0 /t:Rebuild /p:Configuration=Release
默认情况下,仅获取nuget.org的源。
RestoreSources
来指定私有源:msbuild /t:restore /p:RestoreSources=xxx /tv:15.0 /t:Rebuild /p:Configuration=Release
请查看还原目标以获取更多细节。
/p:RestoreSources=
中,多个来源需要用转义版本的分号;
-> %3B
进行拆分。例如,对于url1
和url2
,应写为/p:RestoreSources=url1%3Burl2
。 - Nenad/p:RestoreAdditionalProjectSources=…
来指定其他的源。/restore
(MSBuild 15.3+)代替同时指定Restore
和其他目标,以便所有由NuGet生成的更改文件都能正确重新加载。RestoreAdditionalProjectSources
而不是 p:RestoreSources
? - nl-xMS Build 从解决方案根目录读取 NuGet.Config 文件。您可以添加一个新的 Nuget.config 文件,并在其中指定外部仓库。
我在位于'%appdata%\NuGet\NuGet.Config'的nuget.config文件中添加了一个新的软件包源,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="anotherSource" value="http://10.2.36.4:53673/nuget" />
</packageSources>
</configuration>