Mark20
Mark20

Reputation: 105

Is there a command to point nuget.exe to a specific NuGet.Config file?

I am trying to install Nuget packages via the cmd because our program runs on multiples VMs which chosen randomly. Some of these VMs have Nuget installed and have a NuGet.Config file which installs the packages in a folder my project cannot detect.

I created my own NuGet.Config and put in the root of my project folder, I tested it locally and everything works fine. I want something like "nuget.exe -configfile NuGet.Config" so that the packages will be installed in my project folder as I configured. Any help?

Upvotes: 4

Views: 2217

Answers (1)

jcespinoza
jcespinoza

Reputation: 313

Yes. Based on the docs, the NuGet CLI accepts an option to indicate which config file to use. The syntax goes as follows:

nuget.exe restore -ConfigFile <a-path-to-the-config-file>

In your case:

nuget.exe restore -ConfigFile .\NuGet.Config

Based on the details on your question, the "restore" part was all that it was missing.

Upvotes: 5

Related Questions