Microsoft just released Visual Studio Code a couple of days ago.
How can we debug an ASP.NET MVC applications from within that IDE?
Open vscode and install the C# Extension.
ext install csharp
Open your project's directory in vscode. File > Open Folder...
Vscode might ask: Required assets to build and debug are missing from your project. Add them?
If so, choose Yes. This will add a .vscode
directory with a launch.json
and tasks.json
file.
Note: If vscode does not ask this, you must ensure those files have the appropriate settings. One way to do that is to delete the existing .vscode
directory and then restart vscode.
Open the Debug View (CTRL + SHIFT + D), choose a configuration, and click the green arrow. If you aren't sure which configuration to choose, use .NET Core Launch (web).
If you're setup properly, the web browser will open at localhost:5000 and the DEBUG CONSOLE will display output.
This works for an EXE in net451
.
"program": "${workspaceRoot}\\bin\\Debug\\net451\\myApp.exe",
This works for a DLL in netcoreapp1.0
.
"program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\myApp.dll",
Enable portable PDBs by adding the following entry. Otherwise you will receive the "No symbols have been loaded for this document" message.
"buildOptions: {
"debugType": "portable",
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With