Improved support for local NuGet.Config files. #466
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for a better handling of
NuGet.Config
files and fixes #463 .We used to make an attempt to resolve the various NuGet elements/tags from a given script folder.
This had the drawback of expanding environment variables that could contains sensitive information such as repository credentials.
As it turned out,
dotnet restore
has a--configfile
argument that lets us pass the path to theNuGet.Config
file. This file may not be in the script folder, but it can also be in a parent folder relative to the script folder. So we useSettings.GetConfigFilePaths
(NuGet.ProjectModel) for this.The first in this list is the "nearest" config file seen from the script folder.
https://github.com/NuGet/NuGet.Client/blob/9dac90978fe16f0b097b4b4b910ffb8dfdc059b6/src/NuGet.Core/NuGet.Configuration/Settings/Settings.cs#L583
Also some general housekeeping like excluding the test scripts from OmniSharp which improves the experience when working with dotnet-script in OmniSharp/VS Code.