I have fresh install of VSCode, and this tiny basic TypeScript app.
First time, when I want to build the app, VScode needs to generate tasks.json.
And it worked long time ago before.
Today I am getting this weird message
No build task defined. Mark a task with 'isBuildCommand' in the tasks.json file.
I don't remember seeing this message before.
But, OK, I click Configure Build Task, select TypeScript task, and tasks.json gets generated.
But, what happens, after I try to build now, Ctrl+Shift+B, and I get the exact same message again
Any ideas? Thanks.
BTW, adding this setting to tasks.json doesnt solve the problem.
Tasks in VS Code can be configured to run scripts and start processes so that many of these existing tools can be used from within VS Code without having to enter a command line or write new code. Workspace or folder specific tasks are configured from the tasks. json file in the . vscode folder for a workspace.
json files are located in a hidden folder called . vs in the root folder of your codebase. The tasks.
tasks. json is used to execute anything else you may want, be that source code formatters, bundlers or a SASS compiler. To use a configuration from tasks. json , you select Run Task from the command list.
This issue was also adressed here: https://github.com/Microsoft/vscode/issues/24796
It says:
Closing and reopening the window (without starting Code) resolves this issue.
Closing and reopening the window
Which window? Closing and reopening the tasks.json window didn't work for me (in VS Code 1.11.2).
Here's what did though:
In my case, my tasks.json
had some nonsense in it. Instead of the "command" property, I wrongly named it "executable"...*
So consider if:
Syntactically invalid:
Schematically invalid:
And while I think the other answers are probably correct (I can't reproduce so I can't verify; the issue has been fixed...), I think when the comment said ...
Closing and reopening the window (without starting Code)
... it may have meant the Reload Window
command.
*I wrongly named the tasks.json
property "executable", vs "command" because...
I don't know why I thought "executable" was valid! I thought I was referencing some example, but can't find it... :) )
[As of 18th September 2021] and VS Code version:
1.60.0
For me, it turned out to be that I wasn't having "isBuildCommand": true
.
I understand that this post already assumes that isBuildCommand
is already included. But VS Code didn't include this by default for me and being new to VS code if I reached this page, it might be helpful to someone else who is new.
I wanted to have two configurations - Debug
and Release
. This is how my two configs looks -
{
"label": "build Debug",
"command": "dotnet",
"type": "process",
"isBuildCommand": true,
"args": [
"build",
"${workspaceFolder}/ABCD/ABCD.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build Release",
"command": "dotnet",
"type": "process",
"isBuildCommand": true,
"args": [
"build",
"${workspaceFolder}/ABCD/ABCD.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-c",
"Release"
],
"problemMatcher": "$msCompile"
}
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