如何使用.Net Core和VSCode在调试模式下执行测试? [英] How do I do I execute tests in Debug mode using .Net Core and VSCode?

查看:250
本文介绍了如何使用.Net Core和VSCode在调试模式下执行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How do I execute tests in Debug mode using .Net Core and VSCode?

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

I am currently running the following on the command line:

dotnet Test

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

However, this is not executing the tests in debug mode.

我是否连接调试器?

如果是这样。 ..如何?

If so... How?

推荐答案


  1. 如有必要,请将测试项目转换为控制台应用程序图书馆。例如,使用

< TargetFramework> netcoreapp2.0< / TargetFramework>


  1. 添加主要方法或函数。


    // C#
    class Program
    {
        static void Main(string[] args)
        {
        }
    }




    // F#
    module Program =
        [<EntryPoint>]
        let main(args: string[]) = 0




  1. 在主菜单中,调用要调试的测试。

  1. In the main, call the test that you want to debug.

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

Run the console application in the debugger (usually pressing F5).

这对运行<$应该没有影响c $ c> dotnet测试。

这篇关于如何使用.Net Core和VSCode在调试模式下执行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆