问题
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.
Do I attach a debugger?
If so... How?
回答1:
- If necessary, convert the test project to be a console app, instead of a library. For example, use
<TargetFramework>netcoreapp2.0</TargetFramework>
- Add a main method or function.
// C# class Program { static void Main(string[] args) { } }
// F# module Program = [<EntryPoint>] let main(args: string[]) = 0
In the main, call the test that you want to debug.
Run the console application in the debugger (usually pressing F5).
This should have no effect on running dotnet test
.
来源:https://stackoverflow.com/questions/45526413/how-do-i-do-i-execute-tests-in-debug-mode-using-net-core-and-vscode