繁体   English   中英

Visual Studio 代码 C# “在不调试的情况下运行”错误

[英]Visual Studio Code C# "Run Without Debugging" error

我在 Ubuntu 18.04 上安装了 Visual Studio Code 1.56.2 来开发 Python。

几天前,我已经安装了“.NET Core for C# 在 Linux 上的编码”,所以我可以使用 Visual Studio Code 对 C# 进行编码。

当我尝试运行“Program.cs”(hello world)应用程序时,我弹出 window 并显示错误“您没有用于调试 C# 的扩展程序。我们应该在市场上找到 ZD7EFA19FBE7D3972FD5ADB6024223D74 扩展程序吗?”

我已经安装了“C# for Visual Studio Code(由 OmniSharp 提供支持)。Microsoft”,如下所示:

在此处输入图像描述

这是我的工作区结构:

在此处输入图像描述

我将不胜感激任何帮助解决这个问题。

确保在项目/解决方案根目录中名为.vscode的文件夹中同时拥有launch.jsontask.json

如果你不这样做,你可以 go 到菜单Run > Add Configuration...

在此处输入图像描述

它应该自动创建文件,但如果你不能,这里是这些文件内容的示例(你需要调整到本地 fylesistem/project/version 值)

任务.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "shell",
            "args": [
                "build",
                // Ask dotnet build to generate full paths for file names.
                "/property:GenerateFullPaths=true",
                // Do not generate summary otherwise it leads to duplicate errors in Problems panel
                "/consoleloggerparameters:NoSummary"
            ],
            "group": "build",
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        }
    ]
}

发射.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            "program": "${workspaceFolder}/bin/Debug/net5.0/net.dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            "console": "internalConsole",
            "stopAtEntry": false
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"
        }
    ]
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM