question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add --sdk-version to dotnet to choose which SDK to use

See original GitHub issue

Currently, the only way to use a specific version of the .NET core SDK (that isn’t the most recent version installed) is with a global.json file.

We’d like the dotnet command to have a command line option that selects which SDK to use.

We have a build tool that automatically downloads and installs the version of the SDK the user wants to use. If they don’t specify a specific version, we download the latest LTS and install it into a local directory. If the user later installs (or has already installed) the latest Current version of the SDK globally, their next build will use that version instead of the LTS version. Chaos ensues.

The published workaround is to use a global.json file. Unfortunately, once they use a global.json file, they are then pinned to that version, instead of always getting the latest LTS version. 😦

Please add a --sdk-version option to the dotnet command for choosing what version to use. That way, our build took can use it to guarantee a user is always on the version they want.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
KathleenDollardcommented, Mar 19, 2018

If 2 people misread this, we should perhaps tweak. @spboyer and @PRIMETSS, do you think the following change would have helped?

Current docs:

globaljson –sdk-version <VERSION_NUMBER> - Specifies the version of the .NET Core SDK to use in the global.json file.

Suggestion:

globaljson –sdk-version <VERSION_NUMBER> - Specifies the version of the .NET Core SDK to use in the global.json file in the generated output.

0reactions
PRIMETSScommented, Mar 19, 2018

For me the miss understanding wasn’t the wording or explanation as such, it was the simple fact I came across the doc when searching for something specific relating to what SDK version I was targeting on a machine that had multiple. I was investing if this was causing an issue. So as typical my eye caught “–sdk-version” and because it ‘sounds’ like a stand alone switch so I started to try and use it without refering to the doc. So the problem is I miss understood the option is a switch on the Template, not stand alone say like ‘–force’ or ‘new’. Its a silly over look, as I mentioned above, as the Doc is totally correct and once read carefully from the top to bottom it explains how to use it with the global.json Template. I think maybe because the global.json template is a bit of an ‘odd’ template as it just generates the global.json file and sticks the --sdk-version text in there. It might help if there was a description line under globaljson that just highlights/reminds people what it does. What would have also helped for me is if the example had its full use , eg "globaljson --sdk-version <VERSION_NUMBER>

I originally thought fully written examples everywhere might be a better way to go, but after a bit of thought I can see that’s a major re-write of the docs, and also would require options that had multiple 1st part options like console/angular/react… would mean that you would need to show full text examples for each possible combination… which of course is a totally a waste of time, and would make the doc size grow

console, angular, react, reactredux –no-restore - Doesn’t perform an implicit restore during project creation.

So again, its a silly one. But I think just a line under each template with a brief description of what they do (even though most are obvious) would help people to not assume like I did that --sdk-version somehow did some magic in the background.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select which .NET version to use
When you run an SDK command, the SDK uses the latest installed version. ... NET CLI must choose an SDK version for every...
Read more >
Switch between dotnet core SDK versions
If you want to create a new project using a specific version you can go to this directory 'C:\Program Files\dotnet\sdk' then add an...
Read more >
How to Change Default DotNet SDK Version
In order to change default dotnet SDK version, place a global.json file in the current folder or any parent folder with the contents...
Read more >
How to switch .Net core version | Interview Question - YouTube
2. dotnet --info It displays all the sdk version installed on the machine. 3. dotnet new globaljson ... How to setup selenium grid...
Read more >
Switching between .NET Core SDK Versions
The answer is that we can easily switch between versions of the SDK by creating a global.json file. It simply needs to reside...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found