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

API to get global tools path #6260

Closed
wli3 opened this issue Dec 5, 2017 · 15 comments
Closed

API to get global tools path #6260

wli3 opened this issue Dec 5, 2017 · 15 comments

Comments

@wli3
Copy link

wli3 commented Dec 5, 2017

Tools CLI ask

  1. Need to be in user directory
    Or at least an option to say “only user directory”. Current all global tool is user level, since we don’t want to require user to run with sudo. While today’s NuGet cache could be user level or machine level.

  2. All the “format”
    This is due to weird behavior when using profile.d and paths.d adding to PATH. For mac, if we want to add user directory using paths.d. It has to be in ~/.nuget/ toolsdir format (before tilde expansion). And for Linux using profile.d, it has to be $HOME/.nuget/toolsplace format. The full path will also be used to display message to user. To make such API look nice turned out is hard.

@wli3 wli3 mentioned this issue Dec 5, 2017
4 tasks
@nkolev92 nkolev92 self-assigned this Dec 5, 2017
@nkolev92 nkolev92 added Functionality:Restore Area:RestoreTool V1/V2 tool restore Type:DCR Design Change Request labels Dec 5, 2017
@nkolev92 nkolev92 added this to the 4.6 - Dec26-Jan13 milestone Dec 5, 2017
@nkolev92 nkolev92 changed the title API to get tools folder from NuGet API to get global tools path Dec 5, 2017
@nkolev92
Copy link
Member

nkolev92 commented Dec 5, 2017

Dup of #6253.

Deduping that in favor of this one, so it's easier to track for you.

@nkolev92
Copy link
Member

Clarified with Rob, here the ask is actually to just return the GlobalPackageFolder location specified in the "Machine-Wide" config.

I'm not sure any of the points listed in the original issue are a concern.

Will clarify offline if we want to have this as an MSBuild target, or just use the already existing APIs.

@wli3
Copy link
Author

wli3 commented Dec 11, 2017

We need talk more about this problem. We need an API similar to https://github.com/dotnet/cli/blob/55f62d9d646b558d53c56e226a9ddc3dc003a23b/src/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs#L44

And as the issue stated, it cannot simply return the full path.

@rrelyea rrelyea added Type:Feature and removed Type:DCR Design Change Request labels Dec 11, 2017
@nkolev92
Copy link
Member

nkolev92 commented Dec 11, 2017

@wli3
There's already APIs that allow you to do what you're asking for above and I'm not aware of any issues like the ones you listed under 2.

Can you please try the following

var machineWideSettingsOnly = Configuration.Settings.LoadDefaultSettings(
                    root: null,
                    configFileName: null,
                    machineWideSettings: new XPlatMachineWideSetting());

SettingsUtility.GetGlobalPackagesFolder(machineWideSettingsOnly);

@nkolev92
Copy link
Member

How do we handle the scenario where the global packages folder is at the root of a drive? Example F:
The tools folder cannot be at the same level as this.

@anangaur @rrelyea @emgarten @wli3

@wli3
Copy link
Author

wli3 commented Dec 14, 2017

We do need to think more and decide where to put the logic. In the end, this should not be allowed. Also, I was about to talk about it yesterday, tools folder should be at least per user (ideally it can only be in user's folder) like %userprofile%/.nuget. If tools folder is shared between 2 users like , their tools will be mixed. So if the user want to use D:\sdktool, we should at least end up with D:\sdktool\johnsmith . Or just straight up throws

@wli3
Copy link
Author

wli3 commented Dec 14, 2017

I am thinking can we not allow this to be set? Or only allow setting the part after user directly.

The validation logic will be very hard. If we move most of this logic to CLI, it won't help too much. CLI will ask for a list of candidate and validate from top to bottom until finding one or throws. However, NuGet will have no idea which one CLI actually picked. And the worst part is, the user changed the config. The candidate list changed, the new location is not deterministic. Also, what to do with existing tools. Should we migrate them after tools location changed

@nkolev92
Copy link
Member

nkolev92 commented Dec 14, 2017

@wli3
In the end, NuGet would just be reading a predetermined config file.

We cannot control if the users change these values.

CLI figuring out the path on its own would allow you the most control.

Why do you say it won't help?
It's literally a predetermined place to install these tools.
And you just won't make it configurable.

@nkolev92
Copy link
Member

nkolev92 commented Jan 5, 2018

This is on hold right now, due to design changes.

@anangaur
Copy link
Member

anangaur commented Jan 5, 2018

@nkolev92 shouldn't be required now. right? Are we still deliberating on the location of the extracted tools package payload?

@nkolev92
Copy link
Member

nkolev92 commented Jan 5, 2018

@anangaur
As far as I know, we moved it.

Haven't heard any official confirmation though, so I was gonna leave it open.

@wli3 Can we close this now?

@nkolev92
Copy link
Member

Redundant now.

@livarcocc
Copy link

I am confused. @anangaur you were the asking for tools to be placed next to the user's NuGet package cache, because it allowed you in the future to maybe move this functionality into nuget.exe.

Is this something that you guys are no longer interested at and now we will keep tools under the .dotnet folder?

Also, if this will be under a NuGet folder, we will not hand craft that location, which is why @wli3 asked for an API. I thought we were in agreement on this with @rrelyea.

I am sorry if I am missing something here, I guess I don't have the whole story.

@nkolev92
Copy link
Member

I don't think we want the tools functionality in NuGet.exe anymore.

There's also the issue that even our machine-wide config can still be changed, so this tools location could not be enforced permanently.
The root of the drive issue described above, etc.

I'd still wait on @anangaur and @rrelyea to confirm that we're on the same page.

@anangaur
Copy link
Member

Just to clarify, we may want this functionality in NuGet in future but we will use the same .dotnet folder that we all decided on. I think we all (including @livarcocc)are on the same page on this now :)

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