Run and debug .NET executables without source code
If you need to launch a compiled .NET executable without source code, you need to configure the startup properties of the target executable in a run configuration. Once the configuration is created, you can launch it with the debugger attached Shift+F9 or without debugging Shift+F10. In case of debugging, the executable will be automatically decompiled.
Another scenario is using a compiled .NET executable as a part of testing or debugging your project of non-executable type, for example, a class library. In this case, you need to launch the created configuration together with another configuration that executes your code as multiple targets.
Create a run configuration for .NET executable
Open the Run/Debug Configuration dialog in one of the following ways:
Selectfrom the main menu.
With the Navigation bar visible ( ), choose from the run/debug configuration selector.
Press Alt+Shift+F10 and then press 0.
In the Run/Debug Configuration dialog, click Add New Configuration Alt+Insert, choose the .NET Executable configuration type, and specify a name that will help you identify this configuration in the future.
Specify the path to the target executable.
Optionally, specify program arguments that will be passed to the executable when the configuration is started. Multiple arguments should be separated with whitespaces.
Optionally, specify a custom working directory, otherwise the directory of the target executable will be used.
Optionally, specify custom environment variables for the target executable in the following format:
Optionally, specify .NET runtime arguments. Multiple arguments should be separated with whitespaces.
Both .NET and Mono support setting custom runtime arguments when launching an application. For example, Mono supports many runtime arguments to customize how your application is run. You can select the garbage collector to be used (
--gc=sgen), on macOS you can select the runtime architecture to be used (
--arch=64), and more.
Optionally, use the Runtime selector to choose one of the runtimes available on your machine.
If you are working on Windows, you can check how your application works with the Mono runtime. JetBrains Rider will use the Mono executable specified on thepage of JetBrains Rider settings Control+Alt+S.
To debug with Mono runtime, you need:
Portable PDB in your projects —
<debugtype>portable</debugtype>in the .csproj file, or alternatively, generate mdb with pdb2mdb.
Note that this checkbox does not affect classic .NET application types (for example, .NET Console Application) — their output in always shown in an external window.
Click Apply to save the configuration.