Add --legacy-packages-directory to Xplat restore #814
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.
Add a new switch
--legacy-packages-directory
toNuGet.CommandLine.Xplat
(i.e.dotnet restore
) which allows the caller to restore to the packages folder folders with original case ID and version.Since the correct format of the global packages folder is
{root}/{lowercase-id}/{lowercase-version}
, this is done by first restoring to lowercase folder names then, as a post-process step to the restore operation, copy the packages to{root}/{original-id}/{original-version}
. This allows the legacy mode to be minimally invasive to the main restore operation.This command line option is part of a backwards compatibility story so that 1.0.0 Corehost can still find packages restored by newer version of NuGet.
Corehost reads a
.deps.json
file generated by .NET CLI. .NET CLI generates the.deps.json
file from theproject.lock.json
file that we write out. When the--legacy-packages-directory
switch is passed, the lock file written out has thepath
property of eachpackage
library converted from lowercase to original case.Next steps are modifying CLI to include the
path
property in the.deps.json
file and modifying Corehost to prefer thispath
property over the concatenation of the library ID + library version.@emgarten @alpaix @rohit21agrawal @rrelyea