How to change default dnx version is Visual Studio Code?
Asked Answered
L

3

13

I am not sure if it is possible but I want to change dnx version when dnx . run from Visual Studio Code.

Even if my current dnx version is 1.0.0-beta5-11682 coreclr Visual Studio Code runs with 1.0.0-beta4 mono

Is it possible to change default dnx version of Visual Studio Code?

Some settings

Lydie answered 7/5, 2015 at 20:19 Comment(0)
A
15
dnvm use VERSION -p

where -p is persistent, you can use without it to set version just for the current session.

example

dnvm use 1.0.0-beta4

or

dnvm use 1.0.0-beta4 -p
Avenge answered 8/5, 2015 at 10:9 Comment(2)
Even I set like this, when I run dnx: run from VSCode, "cd /Users/Arda/HelloVSCode ; /Users/Arda/.dnx/runtimes/dnx-mono.1.0.0-beta5-11735/bin/dnx . run" it is executed like this. So still mono.1.0.0-beta5-11735 is current dnx version with VSCodeLydie
Yes, it did not help. The interesting thing is when I change the dnx runtime to coreclr, dnx command does not appear in VS Code's command pallette when I restart VSCodeLydie
S
12

dnvm use <runtime_version> -r <runtime> -a <architecture> -p

examples:
<runtime_version>: 1.0.0-rc1-update2 etc.
<runtime>: mono, clr, coreclr (optional)
<architecture>: x64, x86 (optional)
-p: makes the results persistent (optional)

Selecting Active:

You have to provide the Runtime version as well, if there are multiple choices for the same name. For example type the following:

dnvm use 1.0.0-beta4 -r mono

If you would have to provide Architecture as well, the following command would apply:

dnvm use 1.0.0-beta4 -r mono -arch <architecture>

where can be "x64" for example, without the quotes.

Setting Default:

dnvm alias default 1.0.0-beta5-11682 -r coreclr -arch x64

Please note that, there were a bug (about May, 2015), in which referring to a CoreClr runtime by alias was not working. I don't know if it's fixed yet, but I guess so. Source: Issue 175 about the bug.

Shore answered 26/11, 2015 at 9:12 Comment(0)
E
0

You can either set a version in the global.json file (like so https://github.com/OmniSharp/omnisharp-roslyn/blob/master/global.json#L4) or use the combination of dnvm alias and dnvm use. OmniSharp (the C# brain used by VSCode) will first check the global.json file and then go with the default-alias. All the details can be found here: https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp/AspNet5/AspNet5Paths.cs#L45

Enchorial answered 8/5, 2015 at 13:27 Comment(4)
I add the global.json with coreclr version. But again when I run dnx:run from vscode, the current execution command like "cd /Users/Arda/HelloVSCode ; /Users/Arda/.dnx/runtimes/dnx-mono.1.0.0-beta5-11735/bin/dnx . run" I just want to be executed as CoreCLR "cd /Users/Arda/HelloVSCode ; /Users/Arda/.dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-beta5-11735/bin/dnx . run"Lydie
Please check the OmniSharp log in VSCode (Ctrl+U,L) for what version was picked for your project. For executing commands, VSCode will take that version as well.Enchorial
I am running omnisharp-atom, I am getting error message "No default runtime found" I have installed 1.0.0-beta4 as per the README file. Is Omnisharp-Roslyn installed as part of that, is so where does it reside?Rica
yeah, there should be a node_module shipping with omnisharp-atom which contains omnisharp roslyn. tho the error is saying that it failed to find a DNX runtime.Enchorial

© 2022 - 2024 — McMap. All rights reserved.