JIANG💗帅

使用vscode调试c#控制台程序

摘要:

使用vscode调试c#程序代码
通用于windows,mac,linux

🔷添加VS Code插件,安装C#,C# Dev kit插件

🔷添加lanuch.json配置

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask":  "build",
            "name": ".NET Core Launch (console)",
            "program": "${workspaceFolder}/ConsleVSCode/bin/Debug/net8.0/ConsleVSCode.exe",
            "args": [],
            "cwd": "${workspaceFolder}",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart"
        }
    ]
}

🔷新增 tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}"
            ],
            "problemMatcher": "$msCompile"
        }
    ]
}

完成以上设置后,即可正常调试C#代码

分享到:
打赏
全部内容原创,欢迎转载

作者: shuai, 转载或复制请以 超链接形式 并注明出处 JIANG💗帅
原文地址: 《使用vscode调试c#控制台程序》 发布于2025-3-23

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏