Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download tool packages from NuGet feeds directly, instead of implicitly restoring #31134

Closed
Tracked by #29436
baronfel opened this issue Mar 10, 2023 · 6 comments
Closed
Tracked by #29436
Assignees
Milestone

Comments

@baronfel
Copy link
Member

Is your feature request related to a problem? Please describe.

Currently to install a .NET SDK tool we acquire the nuget package by restoring a temporary project. This has a number of side effects, which often show up as flaky restore errors because MSBuild concepts like Directory.Build.props, or other heirarchical notions, pollute the restore.

Describe the solution you'd like

We should query NuGet APIs for explicit versions of tool packages to download, and download them via the NuGet API (of course handling authentication, NuGet.config files, etc in a consistent manner as Restore does).

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Mar 10, 2023
@baronfel baronfel removed the untriaged Request triage from a team member label Mar 10, 2023
@baronfel baronfel added this to the 8.0.1xx milestone Mar 10, 2023
@KalleOlaviNiemitalo
Copy link

Is this what was requested in #22349? Which was closed because "we won't be able to make this change."

@baronfel
Copy link
Member Author

@nkolev92 any insight into @KalleOlaviNiemitalo's question? To me, for tools specifically, we should be able to

  • query NuGet for versions of the Package ID the user requested (adding the implied constraint of PackageType == DotnetToolPackage or whatever the named constant is)
  • use the version the user requested (if any) to pick the latest matching version of that Package Id
  • download and extract that NuGet package and continue about our day

@nkolev92
Copy link
Contributor

Tools depends on restore for assets and compatibility selection.
By calling restore, you're also getting all the user configuration, handling of multiple feeds, plus things like source mapping are respected.

I think it's a lot of code that you'd have to maintain separately that duplicates a lot of what restore does today.

@baronfel
Copy link
Member Author

When you say assets and compatibility - for tools we know what the TFM, architecture, and OS platform should be - the ones from the currently-running host and SDK installation. Isn't that enough to serve as inputs into the selection algorithm?

@nkolev92
Copy link
Contributor

The SDK does know everything it needs to, but restore is not necessarily written like a library, but rather a tool, which is why I think maintaining multiple workflows could potentially be costly.

In the past, downloading was not done on the SDK side either, so there's some API knowledge on that end, so maybe those concerns are lesser now.

@marcpopMSFT
Copy link
Member

Merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants