How to specify private nuget package source in msbuild 15.0 command line?

Aathira picture Aathira · May 22, 2018 · Viewed 10.6k times · Source

Is it possible to specify private nuget feed server while using msbuild 15.0 in vs 2017? The current powershell command I am using is following:

&$msbuild /t:restore /tv:15.0 /t:Rebuild /p:Configuration=Release

This is by default fetching only nuget.org's feed.

Answer

Leo Liu-MSFT picture Leo Liu-MSFT · May 23, 2018

How to specify private nuget package source in msbuild 15.0 command line?

If you want to restore the nuget package only from the specify private nuget package source, you could use the property RestoreSources to specify private source:

msbuild /t:restore /p:RestoreSources=xxx /tv:15.0 /t:Rebuild /p:Configuration=Release

Check the restore target for some more details.