Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blazor client WASM launch configuration for VSCode

Where can I find an example of the .NET Core Launch (Blazor Standalone) launch configuration? And before you refer me to this https://docs.microsoft.com/en-us/aspnet/core/blazor/debug?tabs=visual-studio-code&view=aspnetcore-3.1#vscode I have already been there. No actual example of the configuration file is present.

like image 849
Archon Avatar asked Apr 15 '20 01:04

Archon


2 Answers

I struggled with this too; Just debug with ".Net Core" should be first choice; should auto generate:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Launch (Blazor Standalone)",
            "type": "coreclr",
            "request": "launch",
            "program": "dotnet",
            "args": [
                "run"
            ],
            "cwd": "${workspaceFolder}/src/Project.UI",
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        },
        {
            "name": ".NET Core Debug Blazor Web Assembly in Chrome",
            "type": "pwa-chrome",
            "request": "launch",
            "timeout": 30000,
            "url": "https://localhost:5001",
            "webRoot": "${workspaceFolder}/src/Project.UI",
            "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
        }
    ]
}
like image 74
John Gold Avatar answered Sep 20 '22 10:09

John Gold


You need to create a build task (task.json) first for the blazor WebAssembly

   {
   // See https://go.microsoft.com/fwlink/?LinkId=733558
   // for the documentation about the tasks.json format
   "version": "2.0.0",
   "tasks": [
      {
         "label": "build",
         "command": "dotnet",
         "type": "process",
         "args": [
            "build",
            "${workspaceFolder}/BlazorSVgTest.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
         ],
         "problemMatcher": "$msCompile"
      },
   ]
}

And then create a launch task (launch.json) with debug enabled

{
   // See https://go.microsoft.com/fwlink/?LinkId=733558
   // for the documentation about the tasks.json format
   "version": "2.0.0",
   "tasks": [
      {
         "label": "build",
         "command": "dotnet",
         "type": "process",
         "args": [
            "build",
            "${workspaceFolder}/BlazorSVgTest.csproj",
            "/property:GenerateFullPaths=true",
            "/consoleloggerparameters:NoSummary"
         ],
         "problemMatcher": "$msCompile"
      },
   ]
}
like image 32
Daniel Avatar answered Sep 20 '22 10:09

Daniel