'VSCode build not working - No build task defined. Mark a task with 'isBuildCommand' in the tasks.json file
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.
Solution 1:[1]
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.
Solution 2:[2]
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:
- Closing and re-opening Visual Studio Code
- Ctrl-Shift-B (or your build shortcut)
Solution 3:[3]
In my case, my tasks.json
had some nonsense in it. Instead of the "command" property, I wrongly named it "executable"...*
So consider if:
- Your JSON is valid syntactically (see screenshot below)
- Your JSON is valid according to what VS Code expects
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 thought "command" was causing issues (it wasn't)
- I wanted to run a specific executable in a specific directory like "C:/somewhere/python.exe"; ("command" can do that).
I don't know why I thought "executable" was valid! I thought I was referencing some example, but can't find it... :) )
Solution 4:[4]
[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"
}
Solution 5:[5]
For me, it worked when I put the tasks.json file in a new .vscode folder next to the file I wanted to build.
- My folder >
- myFile
- .vscode >
- tasks.json
- tasks.json (this file has no effect)
The funny thing is, My folder was already named .vscode in my case. I guess it has to be a sub-layer.
Solution 6:[6]
I had errors even after checking task.json. Turned out to be that there was an error in IntelliSense Configurations - Compiler path...
Not sure if this would help, but it solved my problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | misterkugelblitz |
Solution 2 | Artie Leech |
Solution 3 | |
Solution 4 | |
Solution 5 | user7924 |
Solution 6 | Suraj Rao |