簡體   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