gpt4 book ai didi

c# - Windows 上的 Visual Studio Code、C# 支持

转载 作者:IT王子 更新时间:2023-10-29 04:31:22 25 4
gpt4 key购买 nike

我想试用 Microsoft 的新编辑器 - Visual Studio Code。我想实现一个简单的应用程序(如 Hello、World)并能够对其进行调试。但是经过大量的谷歌搜索和尝试,我没能做到。那可能吗?我有安装了 Visual Studio 2015 的 Windows 10。

我尝试过的事情:

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。生成 msbuild ENOENT"

2) 阅读这篇文章:http://michaelcrump.net/creating-and-debugging-console-apps-with-vscode/ ,但我没有任何 project.json 文件,而且“dnx .run”失败并显示错误“System.InvalidOperationException:无法解析项目

有没有一种简单的方法可以在 VS Code 中运行简单的 C# 应用程序?我想知道为什么这么复杂。可能我遗漏了什么,欢迎提出任何想法。

更新 1:将 msbuild 添加到路径有帮助

最佳答案

The C# support in VS Code is optimized for cross platform .NET development (DNX) (see working with ASP.NET 5 and VS Code for another relevant article. Our focus with VS Code is to be a great editor for cross platfrom C# development - for instance many Unity developers have been enjoying using VS Code in place of Mono Develop.

We support debugging of C# apps cross platfrom via Mono (see Mono Debugging).

Due to this focus many standard C# project types are not recognised by VS Code. An example of a non-supported project type is an ASP .NET MVC Application. In these cases if you simply want to have a lightweight tool to edit a file - VS Code has you covered. If you want the best possible experience for those projects, and development on Windows in general we recomend you use Visual Studio Community.

来自:code.visualstudio.com/Docs/languages/csharp


2017 年 6 月更新:

使用 Microsoft 的 VS Code C# 扩展的 Visual Studio Code 支持 C#:https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp

这可以通过在扩展中搜索“C#”来安装:安装扩展。或者,打开 .cs 文件应该会提示安装扩展。

此扩展支持调试在 .NET CoreMono 上运行的 C# 应用程序,但支持调试在 Desktop .NET Framework 上运行的应用程序 - Visual Studio Community仍然推荐完整的 .NET 项目支持。

有关 VS Code 的 C# 支持的更多信息,请参阅 https://code.visualstudio.com/docs/languages/csharp

有关 VS Code C# 扩展的市场页面,请参阅 https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp

关于c# - Windows 上的 Visual Studio Code、C# 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30728298/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com