如何在VSCode中调试Cake项目?

4
请提供使用VS Code在未安装Visual Studio 2015的机器上进行Cake项目调试的步骤。我在Cake文档中找不到任何调试步骤。
1个回答

10
  1. Install Cake.CoreCLR NuGet package to your tools folder
  2. Install Cake Extension for Visual Studio Code
  3. Set up .NET Core debugger in Visual Studio Code. See http://aka.ms/vscclrdebugger for details
  4. Open the directory containing your Cake files in Visual Studio Code
  5. Create file .vscode/launch.json and add the following content (assuming your Cake file is build.cake)

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": ".NET Core Launch (console)",
                "type": "coreclr",
                "request": "launch",
                "program": "${workspaceRoot}/tools/Cake.CoreCLR/Cake.dll",
                "args": [
                    "${workspaceRoot}/build.cake",
                    "--debug",
                    "--verbosity=diagnostic"
                ],
                "cwd": "${workspaceRoot}",
                "stopAtEntry": true,
                "externalConsole": false
            }
        ]
    }
    
  6. Open your Cake file and add a breakpoint by hitting F9

  7. Hit F5 to start debugging

这段内容摘自Cake网站上Martin Björkström的一篇深入的博客文章:http://cakebuild.net/blog/2016/09/debug-cake-vscode

需要注意的是,VSCode只能用于.NET Core调试,因此任何插件或引用必须可用于.NET Core。

如果要调试标准的.NET Cake,请使用Visual Studio,Gary Ewan Park在这篇博客文章中进行了描述:http://cakebuild.net/blog/2016/05/debug-cake-file


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接