8

I have VSCode version 1.18.1, and this in my Gruntfile.js

grunt.registerTask('release', 'Release process', function(target) {
    ...
}

The target is there so that I can run grunt release:one or grunt release:two. However, I can't figure out how to make VSCode run the task with the one|two target.

This is tasks.json file VSCode created with Grunt task auto detected.

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
    {
        "type": "grunt",
        "task": "release",
        "problemMatcher": [],
        "label": "Release Process",
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }
]
}

If I put release:one to the task attribute of the tasks.json file, VSCode will complain with something like

Error: The grunt task detection didn't contribute a task for the following configuration:

Anyone has done something similar to this? Can you please guide me on how to do it?

Thank you!

1
  • I had similar issue with gulp. I have reinstalled vscode.
    – Arci
    Commented Jan 9, 2018 at 10:56

1 Answer 1

3

The way I solved this issue myself was by creating a Task of type shell instead, and putting in the full command. For example, you can do following:

{ "version": "2.0.0", "tasks": [ { "type": "shell", "label": "Release one", "command": "grunt release:one", "problemMatcher": [], }, { "type": "shell", "label": "Release two", "command": "grunt release:two", "problemMatcher": [], } ] }

Not the answer you're looking for? Browse other questions tagged or ask your own question.