I have been trying to leverage TeamCity's new built in NuGet
capabilities in order to get better control over packages used on all
our dev boxes. Chocolatey fits nicely into this and would allow us to
also handle tool configuration in the same manner. The only snag seems
to be that Chocolatey is forcing NuGet to ignore the contents of its
config file (%AppData%\Roaming\NuGet\NuGet.config) which contains the
definitions of the sources we want to use. This means that we would
have to specify the source every time we call Chocolatey, which is
possible but a bit of a pain.
This is occurring because Chocolatey is trying to handle this itself
and always sets the source parameter on every call to NuGet. If the
Chocolatey script simply did not set the source (unless explicity
used) then NuGet would use its configured sources. I have verified
that this approach works by simply hacking out the source handling
call in my local Chocolatey.ps1 script.
Chocolatey seems to be handling the sources this way only so that it
can inject its own gallery URL as a source. If it were to add the
Chocolatey source directly to the NuGet.config file instead, then all
that extra handling would not be needed.
This approach could also address the multiple sources issue:
Does this approach seem feasible? Are there any use cases that may be
adversely affected by this?
I will trying this out in a fork here: https://github.com/LucidSage/chocolatey