我尝试做的事情:
1)取消注释tasks.json文件中的以下内容:
{
"version": "0.1.0",
"command": "msbuild",
"args": [
// Ask msbuild to generate full paths for file names.
"/property:GenerateFullPaths=true"
],
"taskSelector": "/t:",
"showOutput": "silent",
"tasks": [
{
"taskName": "build",
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// Use the standard MS compiler pattern to detect errors, warnings
// and infos in the output.
"problemMatcher": "$msCompile"
}
]
但是编译(ctrl-shift-b)失败,报错信息为:“无法启动外部程序msbuild。spawn msbuild ENOENT”
2)阅读这篇文章:http://michaelcrump.net/creating-and-debugging-console-apps-with-vscode/,但我没有任何project.json文件,同时“dnx . run
”也会报错“System.InvalidOperationException: 无法解析项目”
是否有一种简单的方法在VS Code中运行简单的C#应用程序?我想知道为什么会这么复杂。可能是我漏掉了什么,欢迎提供任何想法。
更新1:将msbuild添加到路径中有所帮助。
PATH
中,重新启动后它就可以工作了。之前我只将其添加到系统路径中。 - svanelten