如何使用.Net Core和VSCode在调试模式下执行测试?

Sco*_*rod 11 f# .net-core visual-studio-code

如何使用.Net Core和VSCode在调试模式下执行测试?

我目前在命令行上运行以下命令:

dotnet Test
Run Code Online (Sandbox Code Playgroud)

但是,这不是在调试模式下执行测试.

我附加调试器吗?

如果是这样......怎么样?

Wal*_*lly 6

  1. 如有必要,将测试项目转换为控制台应用程序,而不是库.例如,使用

<TargetFramework>netcoreapp2.0</TargetFramework>

  1. 添加主方法或功能.

    // C#
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
    // F#
    module Program =
        [<EntryPoint>]
        let main(args: string[]) = 0
  1. 在main中,调用要调试的测试.

  2. 在调试器中运行控制台应用程序(通常按F5).

这应该对运行没有影响dotnet test.