如何在Visual Studio Code中构建和运行我的第一个helloworld应用程序?

时间:2016-09-12 12:27:57

标签: c# visual-studio-code

我刚刚在我的机器上安装了VS CODE,创建了新文件helloworld.cs。
代码:

using System;
using System.Collections.Generic;
using System.Text;
public class Hello
{
   public static void Main(string[] args)
    {
      System.Console.WriteLine("Hello, World!");
    }
}

F5 (为了选择环境)我选择了VSCODE扩展环境。然后会出现 launch.json 文件,其代码如下所示:

    {
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Extension",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": [
                "--extensionDevelopmentPath=${workspaceRoot}"
            ],
            "stopOnEntry": false,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/out",
            "preLaunchTask": "npm"
        }
    ]
}

现在我保存了launch.json  我收到错误:

Info : No task runner configured.

我选择了dotnet core作为任务运行器,然后弹出 tasks.json 文件:

  {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "npm",
    "isShellCommand": true,
    "showOutput": "always",
    "suppressTaskName": true,
    "tasks": [
        {
            "taskName": "install",
            "args": ["install"]
        },
        {
            "taskName": "update",
            "args": ["update"]
        },
        {
            "taskName": "test",
            "args": ["run", "test"]
        }
    ]
}

最后我编译helloworld.cs并再次弹出错误:

Error: Could not find tha preLaunchTask 'npm'.

我只是迷失在恶性循环中。我钻了basics from Visual Studio site,但我对我正在做的事情一无所知。是否有任何易于理解的维基,博客可以帮助我。

0 个答案:

没有答案