Visual Studio Code 命令“dnx run"无法使用 [英] Visual Studio Code command "dnx run" not available

查看:30
本文介绍了Visual Studio Code 命令“dnx run"无法使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望你们中的一些人已经尝试过用于 OSX 的 Visual Studio 代码,并且已经让它与一个简单的 C# 控制台应用程序一起工作.

我尝试按照下面链接的这个教程进行操作.

另外我注意到教程告诉你从终端运行dnx .run",这对我不起作用,它说命令.run"无效,但dnx run"确实有效并成功运行控制台应用程序.我想知道这是否与它有关.


一些背景信息:

1.) 通过运行以下命令安装 dmvm:

curl -sSL https://raw.githubusercontent.com/aspnet/主页/dev/dnvminstall.sh |DNX_BRANCH=dev sh &&源 ~/.dnx/dnvm/dnvm.sh

2.) 通过运行以下命令安装 dnx mono:

dnvm upgrade -r mono

3.) 通过运行以下命令安装 yeoman:

npm install -g yo

4.) 通过运行以下命令安装 aspnet 生成器:

npm install generator-aspnet

5.) 运行yo aspet"并选择控制台应用程序并为其命名.

6.) 在控制台应用程序目录中运行dnu restore".

7.) 在控制台应用程序的目录中运行dnu build".

8.) 去运行dnx .run"并得到一个错误,说找不到命令.运行命令dnx run"并成功运行控制台应用程序.

9.) dnx run"命令(或它的任何形式)在 VSCode 中不可用,它似乎应该根据教程.

我意识到这并不是一个真正的代码问题,但是关于启动和运行 VScode 的网络资源非常少或令人困惑.此外,我不是一个大的 OSX 专家.有谁知道为什么我在 VSCode 中看不到这个命令?

也许教程已经过时,并且 VSCode 不再提供 dnx run 或类似的东西?

解决方案

dnx run"命令在 vscode 中不可用,因为它默认不在 project.json 命令部分.

我不得不从此更改我的 project.json

命令":{控制台应用程序":控制台应用程序"},

到这里

命令":{"run": "TestConsoleApp"//这是您的应用程序文件夹的名称.},

现在在 VSCode 命令部分输入>dnx run",你应该会看到它可用.

I'm hoping some of you out there have tried out visual studio code for OSX and have gotten it to work with a simple C# console application.

I tried following this guys tutorial, linked below.

Creating and Debugging C# Console Apps with Visual Studio Code on OSX

My problem is that the command "dnx run" is not showing in my command line options in visual studio code. The command "dnx run" works from the terminal, but doesn't show in visual studio code as an available command. All I see from visual studio code for dnx is below.

Additionally I noticed the tutorial tells you to run "dnx .run" from the terminal, this doesn't work for me, it says the command ".run" is invalid, but "dnx run" does work and successfully runs the console application. I'm wondering if that might have something to do with it.


Some background info:

1.) installed dmvm by running this:

curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh

2.) installed dnx mono by running this:

dnvm upgrade -r mono

3.) installed yeoman by running this:

npm install -g yo

4.) installed aspnet generator by running this:

npm install generator-aspnet

5.)ran "yo aspet" and chose console application and named it.

6.) ran "dnu restore" in directory of console app.

7.) ran "dnu build" in directory of console app.

8.) go to run "dnx .run" and get an error saying command not found. Run command "dnx run" and successfully runs console app.

9.) "dnx run" command (or any form of it) is not available from VSCode and it appears it should be according to the tutorial.

I realize this isn't really a code question, but resources on the web are pretty low or confusing regarding getting VScode up and running. Also i'm not a big OSX expert. Does anyone know why I don't see this command from VSCode?

Maybe the tutorial is outdated and dnx run is not available from VSCode anymore or something like that?

解决方案

The "dnx run" command is not available from vscode because its not in the project.json commands section by default.

I had to change my project.json from this

    "commands":
     {
                "ConsoleApplication": "ConsoleApplication"
     },

to this

    "commands":
     {
                "run": "TestConsoleApp"  //this is the name of your application folder.
     },

Now type ">dnx run" into the VSCode command section and you should see it available.

这篇关于Visual Studio Code 命令“dnx run"无法使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆