C# 如何在VisualStudio代码中构建和运行我的第一个helloworld应用程序?
我刚刚在我的机器上安装了VS代码,创建了新文件helloworld.csC# 如何在VisualStudio代码中构建和运行我的第一个helloworld应用程序?,c#,visual-studio-code,C#,Visual Studio Code,我刚刚在我的机器上安装了VS代码,创建了新文件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(以选择环境)选择VSC
代码:
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'.
我只是陷入了恶性循环。我钻研了整个过程,但我对自己在做什么一无所知。是否有任何易于理解的wiki、博客可以帮助我。是否安装了npm?是否安装了npm?