简体   繁体   中英

dnx run a C# Console App on Visual Studio Code

I've followed the steps this guy proposed , but when I write "run" on VSC and select dnx run , it says:

There are no entries to pick from VSC

Here's the Omnisharp console output:

[INFO] Starting OmniSharp at '/Users/jonathan/Documents/UES/IAI/Projects/HelloWorld'...
[INFO] Started OmniSharp from '/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.omnisharp/bin/omnisharp' with process id 524...
[INFORMATION:OmniSharp.Startup] Omnisharp server running using stdio at location '/Users/jonathan/Documents/UES/IAI/Projects/HelloWorld' on host 515.
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] No default runtime found
The specified runtime path 'default' does not exist. Searched locations /Users/jonathan/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1
/Users/jonathan/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1
/Users/jonathan/.dnx/packages/dnx-mono.1.0.0-rc1-update1
/Users/jonathan/.k/runtimes/dnx-mono.default
/Users/jonathan/.k/runtimes/kre-mono.default
/Users/jonathan/.k/packages/KRE-Mono.default
/Users/jonathan/.kre/runtimes/dnx-mono.default
/Users/jonathan/.kre/runtimes/kre-mono.default
/Users/jonathan/.kre/packages/KRE-Mono.default.
Visit https://github.com/aspnet/Home for an installation guide.

[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] No solution files found in '/Users/jonathan/Documents/UES/IAI/Projects/HelloWorld'
[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Detecting CSX files in '/Users/jonathan/Documents/UES/IAI/Projects/HelloWorld'.
[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Solution has finished loading
[ERROR:OmniSharp.Dnx.DnxPaths] The specified runtime path 'default' does not exist. Searched locations /Users/jonathan/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1
/Users/jonathan/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1
/Users/jonathan/.dnx/packages/dnx-mono.1.0.0-rc1-update1
/Users/jonathan/.k/runtimes/dnx-mono.default
/Users/jonathan/.k/runtimes/kre-mono.default
/Users/jonathan/.k/packages/KRE-Mono.default
/Users/jonathan/.kre/runtimes/dnx-mono.default
/Users/jonathan/.kre/runtimes/kre-mono.default
/Users/jonathan/.kre/packages/KRE-Mono.default.
Visit https://github.com/aspnet/Home for an installation guide.
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Scanning '/Users/jonathan/Documents/UES/IAI/Projects/HelloWorld' for DNX projects
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Found project '/Users/jonathan/Documents/UES/IAI/Projects/HelloWorld/project.json'.

UPDATE 1

dnvm list -detailed

Jonathans-MacBook-Pro:~ jonathan$ dnvm list -detailed

Active Version              Runtime Architecture OperatingSystem Alias Location
------ -------              ------- ------------ --------------- ----- --------
       1.0.0-rc1-update1    clr     x64          win                   /usr/local/lib/dnx/runtimes
       1.0.0-rc1-update1    clr     x86          win                   /usr/local/lib/dnx/runtimes
       1.0.0-rc1-update1    coreclr x64          darwin                /usr/local/lib/dnx/runtimes
       1.0.0-rc1-update1    coreclr x64          linux                 /usr/local/lib/dnx/runtimes
       1.0.0-rc1-update1    coreclr x64          win                   /usr/local/lib/dnx/runtimes
       1.0.0-rc1-update1    coreclr x86          win                   /usr/local/lib/dnx/runtimes
  *    1.0.0-rc1-update1    mono                 linux/osx       default /usr/local/lib/dnx/runtimes

I don't see full output from OmniSharp.log in this screenshot but I believe I had similar issue with running application in Visual Studio Code. The problem is related with OmniSharp, which is looking for DNX runtimes in home directory: $HOME/.dnx/runtimes . However, currently dnx runtimes are installed in /usr/local/lib/dnx/runtimes . There are few possibilities how to solve it. I've used probably the easiest one: ln -sfF /usr/local/lib/dnx/runtimes ~/.dnx/

More information about this problem: https://github.com/Microsoft/vscode/issues/126

You can also check where runtimes are located by using command: dnvm list -detailed

My output looks like that (last column is important):


Active Version              Runtime Architecture OperatingSystem Alias   Location
------ -------              ------- ------------ --------------- -----   --------
       1.0.0-rc1-update1    coreclr x64          darwin          default /usr/local/lib/dnx/runtimes
       1.0.0-rc1-update1    mono                 linux/osx               /usr/local/lib/dnx/runtimes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM