简体   繁体   English

dnx在Visual Studio Code上运行C#控制台应用程序

[英]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: 我遵循了这个人提出的步骤,但是当我在VSC上写“ run”并选择dnx run ,它说:

There are no entries to pick from 没有可供选择的条目 VSC

Here's the Omnisharp console output: 这是Omnisharp控制台的输出:

[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 更新1

dnvm list -detailed dnvm列表-详细

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. 在此屏幕快照中,我看不到OmniSharp.log的完整输出,但我相信在Visual Studio Code中运行应用程序时也遇到类似的问题。 The problem is related with OmniSharp, which is looking for DNX runtimes in home directory: $HOME/.dnx/runtimes . 问题与OmniSharp有关,后者在主目录$ HOME / .dnx / runtimes中寻找DNX运行 However, currently dnx runtimes are installed in /usr/local/lib/dnx/runtimes . 但是,当前dnx运行时已安装在/ 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/ 我可能使用了最简单的方法: ln -sfF /usr/local/lib/dnx/runtimes ~/.dnx/

More information about this problem: https://github.com/Microsoft/vscode/issues/126 有关此问题的更多信息: https : //github.com/Microsoft/vscode/issues/126

You can also check where runtimes are located by using command: dnvm list -detailed 您还可以使用以下命令检查运行时的位置: 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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