Skip to content

Instantly share code, notes, and snippets.

@MattMS
Last active August 4, 2019 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattMS/714b4081bf8f3504496f4bc676fee120 to your computer and use it in GitHub Desktop.
Save MattMS/714b4081bf8f3504496f4bc676fee120 to your computer and use it in GitHub Desktop.
Debug Fabulous WPF with VS Code

Debugging WPF application with VS Code

The following code is based on the SqueakyApp demo using Fabulous.XamarinForms

Files

The launch.json and tasks.json are placed inside the .vscode directory beside the sln file. These files are usually created by VS Code, but since there is not a .NET Framework option by default, you can choose the .NET Core options and edit the files after.

launch.json

This is based off the Launch .NET Core configuration.

The type was changed from coreclr to clr. cwd and program were changed to match the .NET Framework build directory.

preLaunchTask must match the label of the build task.

msbuild.bat

msbuild.bat needs to be accessible (in the PATH env var) for the build task to complete. I did not have luck with adding the MSBuild.exe folder to PATH. It is based on VS 2019 Community edition, but 2017 Community is in a similar place.

tasks.json

I received an unclear build fail before I added options.cwd to tasks.json.

{
"version": "0.2.0",
"configurations": [
{
"args": [],
"console": "internalConsole",
"cwd": "${workspaceFolder}/SqueakyApp.WPF/bin/Debug/net472/",
"name": "Launch WPF",
"preLaunchTask": "Build WPF",
"program": "${workspaceFolder}/SqueakyApp.WPF/bin/Debug/net472/SqueakyApp.WPF.exe",
"request": "launch",
"stopAtEntry": false,
"type": "clr"
}
]
}
@echo off
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" %*
{
"version": "2.0.0",
"tasks": [
{
"args": ["/property:GenerateFullPaths=true", "/t:build"],
"command": "MSBuild",
"group": "build",
"label": "Build WPF",
"options": {
"cwd": "${workspaceFolder}/SqueakyApp.WPF"
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile",
"type": "shell"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment