Lambda3/dotnet-commands

Replace manual feed search by NuGet API calls

giggio opened this issue · 1 comments

Right now we search manually using HttpClient. We should switch to NuGet api calls, but it seems some of them are not yet available to .NET Core. Investigate, and replace whatever is possible.

After some research I am pretty sure that there is no .NET Standard API provided by the NuGet team to install or uninstall packages. The only infrastructure available allows us to restore only.

Here are the commands available on the NuGet.CommandLine.XPlat library:
https://github.com/NuGet/NuGet.Client/tree/3.5.0-rc1-final/src/NuGet.Core/NuGet.CommandLine.XPlat/Commands
Here are the commands available on the NuGet.Commands library:
https://github.com/NuGet/NuGet.Client/tree/3.5.0-rc1-final/src/NuGet.Core/NuGet.Commands
.NET CLI only forwards the commands, does not do anything directly:
https://github.com/dotnet/cli/blob/rel/1.0.0/src/dotnet/commands/dotnet-restore/NuGet3.cs
https://github.com/dotnet/cli/blob/rel/1.0.0/src/dotnet/NuGetForwardingApp.cs

We could use the .NET CLI directly, using only the restore functionality. If we decide to only restore, we could continue to manually uninstall, but there is no clear way to determine what version gets installed during the restore, or what version is available. We would need to manually build a project.json for that purpose.

An ideia is to manually query NuGet for the package info, and then restore using .NET CLI, manually creating a project.json for that purpose only, in ~/.nuget/commands.

We need to further investigate.