I have an NUnit test that fails only in Release config, and not Debug config.
I want to investigate with Visual Studio Code, but I can't figure out how to run the test in Release mode. I can't seem to find any VSCode dialog to change the mode, nor (surprisingly) any SO questions that address this specifically.
Specifically, I want to click this "Run Test" link and have it run in Release mode:
You can change the configuration in the launch.json
file, located in the .vscode folder. The config for running tests should look something like this:
{
"name": "Unit Tests",
"type": "dotnet",
"request": "launch",
"program": "${workspaceFolder}/bin/Debug/<YourProject>.dll",
"args": [
"--filter",
"cat==Unit"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
}
You need to change the value of the "program":
field to point to the Release version of your project's DLL file, for example:
"program": "${workspaceFolder}/bin/Release/<YourProject>.dll"
After saving the changes, the "Run Test" link should now run it in Release mode.