Home: MSBuild restore and NuGet.config

Created on 17 Apr 2017  路  4Comments  路  Source: NuGet/Home

When using msbuild to restore packages for a project / solution, how can we explicitly specify a NuGet.config file to use?

Old

> nuget.exe restore -configFile <path to NuGet.config> Roslyn.sln

New, unsure how to specify NuGet.config explicitly.

> msbuild /t:Restore Roslyn.sln

I looked through this page but didn't see an answer

https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore

Docs

Most helpful comment

You can pass it with: /p:RestoreConfigFile=<path>

It looks like the docs need to be updated on this.

For reference the set of properties are here:
https://github.com/NuGet/NuGet.Client/blob/68245312b050c5b992120448353eba3e20cdc414/src/NuGet.Core/NuGet.Build.Tasks/NuGet.targets#L100-L106

All 4 comments

You can pass it with: /p:RestoreConfigFile=<path>

It looks like the docs need to be updated on this.

For reference the set of properties are here:
https://github.com/NuGet/NuGet.Client/blob/68245312b050c5b992120448353eba3e20cdc414/src/NuGet.Core/NuGet.Build.Tasks/NuGet.targets#L100-L106

Thanks! Will leave this open in case you want to use it to track the documentation change.

@karann-msft can we get the docs updated for this? Or possibly I'm just not finding them.

Was this page helpful?
0 / 5 - 0 ratings