I let vscode create launch.json and tasks.json for me in a .net6 windows forms with WebView (Microsoft.AspNetCore.Components.WebView.WindowsForms) I changed it a little and they are:
launch.json:
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
//"request": "launch",
"preLaunchTask": "watch",
"program": "${workspaceFolder}/bin/Debug/net6.0-windows/WinFormsBlazor.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
// "serverReadyAction": {
// "action": "openExternally",
// "pattern": "\\bNow listening on:\\s+(https?://\\S+)"
// },
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:5000"
},
"sourceFileMap": {
//"/Pages": "${workspaceFolder}"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processName": "WinFormsBlazor.exe"
}
]
and tasks.json:
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/WinFormsBlazor.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/WinFormsBlazor.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/WinFormsBlazor.csproj"
],
"problemMatcher": "$msCompile"
}
]
The project is then run for view but debug does not work, Why debug is not working? (debug in .razor files)
I am trying to debug my Laravel application running with Sail using Xdebug in VSCode. But I am getting this error when debug my application.
Here is my launch.json file:
{
// 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": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
},
]
}
Is anyone know what is the problem for this? Thanks you so much!
I generated a new teams app that has a front end and bot features.
Now I would add a backend to manage server logic.
I would not do that in the bot app.
So I used teams toolkit to add new feature:
Logically I have choosen azure functions, because I would be able to deploy all my app components using the toolkit tools.
Now in my project directory I have the the sub-app:
My questions are :
How can I include this backend app to the launch.json and
tasks.json in order to make it debuggable as the bot and the front
end ?
//launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Remote (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 2
}
},
{
"name": "Launch Remote (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 1
}
},
{
"name": "Attach to Frontend (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Frontend (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Bot",
"type": "pwa-node",
"request": "attach",
"port": 9239,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
}
},
],
"compounds": [
{
"name": "Debug (Edge)",
"configurations": [
"Attach to Frontend (Edge)",
"Attach to Bot",
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 2
},
"stopAll": true
},
{
"name": "Debug (Chrome)",
"configurations": [
"Attach to Frontend (Chrome)",
"Attach to Bot",
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 1
},
"stopAll": true
}
]
}
How to make it deployable also directly from the toolkit deployment
tools
When Azure Functions is added to the project, .vscode/launch.json and .vscode/tasks.json should be updated automatically to support debug Azure Functions. Your case is strange. Anyway, you can use following .vscode/launch.json and .vscode/tasks.json to debug your app.
// .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Remote (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 1
}
},
{
"name": "Launch Remote (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 2
}
},
{
"name": "Attach to Frontend (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Frontend (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Backend",
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Bot",
"type": "pwa-node",
"request": "attach",
"port": 9239,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Backend",
"type": "pwa-node",
"request": "attach",
"port": 9229,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
},
"internalConsoleOptions": "neverOpen"
}
],
"compounds": [
{
"name": "Debug (Edge)",
"configurations": [
"Attach to Frontend (Edge)",
"Attach to Bot",
"Attach to Backend"
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 1
},
"stopAll": true
},
{
"name": "Debug (Chrome)",
"configurations": [
"Attach to Frontend (Chrome)",
"Attach to Bot",
"Attach to Backend"
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 2
},
"stopAll": true
}
]
}
// .vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Pre Debug Check & Start All",
"dependsOn": [
"validate local prerequisites",
"start ngrok",
"prepare local environment",
"Start All"
],
"dependsOrder": "sequence"
},
{
"label": "validate local prerequisites",
"type": "shell",
"command": "exit ${command:fx-extension.validate-local-prerequisites}",
"presentation": {
"reveal": "never"
}
},
{
"label": "start ngrok",
"dependsOn": "teamsfx: ngrok start"
},
{
"label": "prepare local environment",
"type": "shell",
"command": "exit ${command:fx-extension.pre-debug-check}",
"presentation": {
"reveal": "never"
}
},
{
"label": "Start All",
"dependsOn": [
"Start Frontend",
"Start Backend",
"Start Bot"
]
},
{
"label": "Start Frontend",
"type": "shell",
"command": "npm run dev:teamsfx",
"isBackground": true,
"problemMatcher": "$teamsfx-frontend-watch",
"options": {
"cwd": "${workspaceFolder}/tabs"
}
},
{
"label": "Start Backend",
"type": "shell",
"command": "npm run dev:teamsfx",
"isBackground": true,
"problemMatcher": "$teamsfx-backend-watch",
"options": {
"cwd": "${workspaceFolder}/api",
"env": {
"PATH": "${command:fx-extension.get-func-path}${env:PATH}"
}
},
"presentation": {
"reveal": "silent"
}
},
{
"label": "Start Bot",
"type": "shell",
"command": "npm run dev:teamsfx",
"isBackground": true,
"problemMatcher": {
"pattern": [
{
"regexp": "^.*$",
"file": 0,
"location": 1,
"message": 2
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "[nodemon] starting",
"endsPattern": "restify listening to|Bot/ME service listening at|[nodemon] app crashed"
}
},
"options": {
"cwd": "${workspaceFolder}/bot"
},
"presentation": {
"reveal": "silent"
}
}
]
}
For deployment, run "Provision in the cloud" first, and then run "Deploy to the cloud" command.
I'm confused when debugging my c++ program with vscode on Windows. I enabled "externalConsole" in "launch.json" but sometimes it did not launch the external terminal. Just a few times before it worked fine and I could input. But now it says it's running with nothing pops out and I find nowhere to input. It just gets stuck there. Are there any ways to solve this?
screenshot.png
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe 生成活动文件"
}
]
}
tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe 生成活动文件",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "C:\\MinGW\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "编译器: C:\\MinGW\\bin\\g++.exe"
}
]
}
I'd like to set my VS Code to debug my React-app created using 'create-react-app'.
I've tried this configuration:
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch node",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/src/index.js",
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true,
"outFiles": []
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 9222,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
]
}
but I get error the following error:
Debugger listening on port 11198
e:\form\src\index.js:1
(function (exports, require, module, __filename, __dirname) { import React from 'react';
^^^^^^
SyntaxError: Unexpected reserved word
...
I guess I need to set the 'preLaunchTask' to babel or the 'outFiles' to some dist folder, but I have no idea where should I point it to.
I'll be grateful for ideas.
tnx
Your config is not correct. It should be:
{
"version": "0.2.0",
"configurations": [{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src",
"userDataDir": "${workspaceRoot}/.vscode/chrome",
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
}]
}
For more details: https://create-react-app.dev/docs/setting-up-your-editor/#debugging-in-the-editor