prelaunch_找不到preLaunch任务“ build”

To configure Visual Studio Code to debug C# scripts on OSX, I followed through all the steps listed in the article below:

When I tried to debug the sample C# script, Visual Studio Code reported this error:

Could not find the preLaunch task 'build'

As a consequence, I could not inspect the variables defined in the script.

This is a copy of the launch.json file:

{

"version": "0.2.0",

"configurations": [

{

"name": "Launch console application",

"type": "mono",

"request": "launch",

"preLaunchTask": "build",

"program": "${workspaceRoot}/Program.exe",

"args": [],

"cwd": "${workspaceRoot}",

"stopAtEntry": false

}

]

}

This is a copy of the tasks.json file:

{

"version": "0.1.0",

"command": "mcs",

"args": [

"-debug",

"Program.cs"

],

"showOutput": "silent",

"taskSelector": "/t:",

"tasks": [

{

"taskName": "exe",

"isBuildCommand": true,

"problemMatcher": "$msCompile"

}

]

}

How do I resolve this?

解决方案

You can use the Visual Studio Code to solve it.

When you see the error message, click on the steps below

Configure Task

Create tasks.json file from template

NET Core Executes .NET Core build commands

The VSCode will create a file like it:

{

// 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 build",

"type": "shell",

"group": "build",

"presentation": {

"reveal": "silent"

},

"problemMatcher": "$msCompile"

}

]

}

It's finished. The VSCode will build the project before run.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值