baseclass / Contrib.Nuget

Extending nuget with nuget packages
MIT License
30 stars 21 forks source link

Support searching for NuGet.config in parent folders #48

Open fgretief opened 6 years ago

fgretief commented 6 years ago

In our system we have a NuGet.config file that lives higher up in the tree than the solution file and it specifies where the packages folder is located. Our builds break because Contrib.NuGet assumes the packages folder is in $(SolutionDir)/packages if it cannot find the NuGet.config file. This pull request fixes that issue.

According to the NuGet documentation, the NuGet.config file is searched by looking through the parent folders until the root folder.

mwrouse commented 6 years ago

This is a problem in our system as well. Was just about to start working on changing this and making a pull request.

@romerod Is there any status on this getting merged and pushed?

It would need a new nuget version.

keithyipkw commented 6 years ago

This is a sample project that reproduces the problem. The correct path to the packages folder should be ParentNuget.config\packages. The error is

The "PackageRetrievalTask" task failed unexpectedly. System.IO.DirectoryNotFoundException: Could not find a part of the path '\ParentNuget.config\Solution\packages'.

ParentNuget.config.zip