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

DotNet SDK Default Paths #1963

Merged
merged 14 commits into from
Jul 1, 2018
Merged

Conversation

baronfel
Copy link
Contributor

@baronfel baronfel commented May 22, 2018

First pass at unifying the default paths to the system-wide install locations.

Outstanding questions:

  • Do we want to take on global.json enhancements here?
  • If so, where should global.json be consulted?

Related to #1961

@baronfel
Copy link
Contributor Author

This failed during the packaging steps for the exact reasons mentioned in the attached discussion: The packaging was done with the C:\Program Files\dotnet version of dotnet and not the local one.

@matthid
Copy link
Member

matthid commented May 22, 2018

Actually the problem is just that we assumed that we install into the default directory here:

https://github.com/baronfel/FAKE/blob/05b844724cee075f318c12e45e17d9b60367042c/src/app/Fake.DotNet.Cli/DotNet.fs#L622-L628

I guess this needs to be changed now as the assumption is no longer true

@baronfel
Copy link
Contributor Author

Ah I see, the install needs to pass that install dir arg, yeah

@matthid
Copy link
Member

matthid commented May 22, 2018

No actually I think the installer should install in users directory as otherwise this only leads to permission problems. So we basically have two "defaults", one where we look for the global installation and one where we look for user-local installations.

@baronfel
Copy link
Contributor Author

If we do that then we have to then do additional probing across the two locations to check which one (or both?) has the intended version. Which again, is hard to reconcile with PATH. Are we sure that permissions will be a big deal?

@matthid
Copy link
Member

matthid commented May 22, 2018

Maybe there is another bug as it seems to ignore the install parameter at the moment

@matthid
Copy link
Member

matthid commented May 22, 2018

Are we sure that permissions will be a big deal?

Yes there will be people on corporate environments who will thank you

@matthid
Copy link
Member

matthid commented Jun 10, 2018

ping :)

@baronfel baronfel force-pushed the dotnet_sdk_probing branch from 703201c to 2550287 Compare June 10, 2018 14:01
@matthid matthid changed the base branch from release/rc to release/next June 10, 2018 15:03
@@ -37,7 +37,10 @@ public class when_discovering_the_lastest_FAKE_package
() => _package.Published.Year.ShouldBeGreaterThanOrEqualTo(2012);

It should_contain_the_license_url =
() => _package.LicenseUrl.ShouldStartWith("https://github.com/fsharp/Fake/blob/master/License.txt") && _package.LicenseUrl.ShouldEndWith("License.txt");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, please just merge release/next I already fixed that (and actually made the same mistake :D )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hahaha we would make the worst C# devs 😄

matthid added 5 commits June 30, 2018 12:50
Also consider all paths when searching for a matching sdk version.
Forward information from install to exec via a new "Version" flag
this flag is used to indicate whether FAKE should write a global.json file.
@matthid
Copy link
Member

matthid commented Jul 1, 2018

@baronfel @TheAngryByrd @kblohm What do you think about 30bf7e8 ? The basic idea is that the "global.json" topic is orthogonal to installing the SDK with FAKE.

This commit

  • introduces a install FromGlobalJson-Api which allows to manage the version in global.json
  • writes global.json before calling dotnet SDK (and deletes it afterwards) to make the SDK choose the correct version
  • Errors out if global.json exists and doesn't match
  • We search and try more directories for installed SDK versions

@matthid matthid merged commit 30bf7e8 into fsprojects:release/next Jul 1, 2018
@kblohm
Copy link
Contributor

kblohm commented Jul 1, 2018

That does probably solve a lot of the versioning problems 👍
Some comments:

  • You might want to add withVersion functions similair to withEnvironment to all the options or at least to the options-module (preferSystemInstall is also in the options-module and i feel like these kinda belong in the same category)
  • It looks like this would not work when there is a global.json file already that is used for something other than specifying the dotnet version (for example https://github.com/onovotny/MSBuildSdkExtras#using-the-sdk)
  • It might be nice to have the option to create a global.json when installing a version with fake, so that the installed version gets used for everything afterwards

@matthid
Copy link
Member

matthid commented Jul 1, 2018

You might want to add withVersion

I'm not sure you want to use the Version option directly, my suggestion would be to always use the result of the install API.

when there is a global.json file

We don't replace an existing file so we either exit with an error or run with the wrong version ... Good catch

It might be nice to have the option to create a global.json when installing a version with fake

For now it's easier to let users create it, because for this we would need a way to figure out if we wrote the file (such that we can overwrite it later if needed). But yeah makes sense.

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

Successfully merging this pull request may close these issues.

3 participants