Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make .nuget\NuGet.Config file attached to VS solution to be not ignored?

Tags:

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

like image 504
alex.b Avatar asked Oct 11 '12 09:10

alex.b


People also ask

Where does Visual Studio Store NuGet config?

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.


1 Answers

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:

  1. .nuget\nuget.config
  2. Recursive walk from project folder to root
  3. 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.

like image 138
olldman Avatar answered Sep 27 '22 18:09

olldman