I've created new solution in Visual Studio, enable nuget package restore and got in soluition root .nuget
folder which contains the following files needed to make package restore work: NuGet.exe
, NuGet.config
, NuGet.targets
.
But I can't make nuget(as Nuget Visual Studio add-in and \.nuget\NuGet.exe
as well) read setting from .\nuget\NuGet.config
file - settings are still read from default %appdata%\NuGet\NuGet.config
.
What have I tried.
I've tried to look where the path to NuGet.config
is specified and haven't found anything like that, and nuget.exe install
command that runs during build doesn't have any parameter saying like "take this nuget.config file".
Also I've removed \.nuget\NuGet.config
and everything works - packages are restored during Visual Studio build and CI one.
Question.
I've got an impression that \.nuget\NuGet.config
isn't used at all.
So essentially the question is: How to make .nuget\NuGet.Config
file to be not ignored?
What am I doing wrong and how to do it write?
Thanks and have a nice %time_of_day% :)
Disclaimer
Everything that I've mentioned above is not a problem/issue - current nuget behavior is completely acceptable for me - I'm asking just because I'm curious and confused at the same time
The NuGet Visual Studio extension, the NuGet Package Manager Console, and the NuGet command-line tool all make use of the NuGet configuration file, which by default is located under %AppData%\NuGet\NuGet. config.
I haven't tried this personally, but here is what the official Nuget 2.1 release notes say:
NuGet.config files are searched for in the following order:
- .nuget\nuget.config
- Recursive walk from project folder to root
- Global nuget.config (%appdata%\NuGet\nuget.config)
The configurations are than applied in the reverse order, meaning that based on the above ordering, the global nuget.config would be applied first, followed by the discovered nuget.config files from root to project folder, followed by .nuget
If this doesn't help I'd suggest you write more specifically what you're trying to achieve and which config settings you're changing - knowing more details about the problem may clarify the situation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With