Skip to content

Task.json shouldn't need to be manually created to build .NET projects before debugging #2263

Closed

Description

For .NET debugging, we currently need to have the user manually create a tasks.json in order to support build. We would like to find some solution to avoid the user needing to do this manually.

A few options:

  1. Support simple shell commands directly inside of launch.json. So if all the user wants to do is execute a command with a default error syntax they don't need this extra file. Example:
    "preLaunchCommand": "dotnet compile"
    Which would execute 'dotnet compile' in the workspace directory.
    -or-
  2. Support auto-generating a tasks.json when creating launch.json. This way we can give them a good default value of it and the user doesn't need to manually enter it.
    -or-
  3. Support defining tasks in an extension's package.json. So the user only needs to create a launch.json if they want to do something weird.

Activity

  1. added
    debug
    feature-request
    tasks
    on Jan 26, 2016
  2. isidorn commented on Feb 10, 2016

    @isidorn

    Gregg Miskelly (@gregg-miskelly) after discussing with Dirk Bäumer (@dbaeumer) we think it is best that we help the user generate tasks.json file. We can not move the task running logic inside the launch.json since then we would have to replicate all the tasks logic into debug.

    Is the task that you want to run a preLaunchTask, or would the user want to run it independent of debug?

  3. gregg-miskelly commented on Feb 10, 2016

    @gregg-miskelly
    MemberAuthor

    Ideally, it would be nice if people could run it some other way too. But running it as a preLaunchTask is the biggest thing that we care about.

  4. isidorn commented on Feb 11, 2016

    @isidorn

    After discussing with Dirk Bäumer (@dbaeumer) we should introduce a way for an extension to contribute an 'initial' tasks.json. This should all live in the task framework, however this is not a small effort so moving it to the backlog and assigning to Dirk.

  5. rkeithhill commented on Feb 13, 2016

    @rkeithhill

    After discussing with Dirk Bäumer (@dbaeumer) we should introduce a way for an extension to contribute an 'initial' tasks.json .

    Yes, please! With the PowerShell extension we want to provide a default task to run Pester tests. It would be great if an extension could provide the initial tasks.json file you get with Tasks: Configure Task Runner. We would also like to provide a problemMatcher that could be referenced from the Pester (test) task. The problemMatcher is somewhat lengthy and it would be nice to reference it like so:

    {
        "version": "0.1.0",
    
        // Start PowerShell
        "command": "${env.windir}\\sysnative\\windowspowershell\\v1.0\\PowerShell.exe",
    
        // The command is a shell script
        "isShellCommand": true,
    
        // Show the output window always
        "showOutput": "always",
    
        // Allow Pester to invoke scripts and run Pester
        "args": [
            "-NoProfile",
            "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process;",
            "Write-Host 'Invoking Pester...'; Invoke-Pester;",
            "Invoke-Command { Write-Host \"Completed all tasks in task runner: $($args[0])\" } -args"
            ],
    
        // Associate with test task runner
        "tasks": [
            {
                "taskName": "Pester",
                "isTestCommand": true,
                "problemMatcher": "$pester"
             }
        }
    }

    Seems like the package.json needs a contributes.Tasks where extension authors can contribute both problemWatchers and task initial configurations.

  6. egamma commented on Feb 17, 2016

    @egamma
    Member
  7. egamma commented on Feb 17, 2016

    @egamma
    Member

    After investigating into this issue we came up with the following proposal:

    Rejected proposals:

    • Support to launch a shell command as a preLaunchTask. To make this properly requires to support all the configuration options (e.g. platform specific commands) that is already provided by the task.json. It doesn't make sense to duplicate this inside the launch.json.
    • Generate the task.json by the generator yo or aspnet - the generators do not want to generate tool specific files.

    Closing this issue.

  8. removed this from the Backlog milestone on Nov 10, 2017
  9. locked and limited conversation to collaborators on Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debugfeature-requesttasks

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions