-
-
Notifications
You must be signed in to change notification settings - Fork 59
Invoke Task from VSCode
Invoke-TaskFromVSCode.ps1 invokes the current task from the current build
script opened in VSCode. It is invoked in the session (by default) or in an
external console (with the switch Console
). The current task is the task at
the caret or above. If there is none then the default task is invoked.
The script requires the VSCode PowerShell extension.
Configure launch.json or the global launch setting so that F5 invokes the current task. See Debugging Tips for the sample launch.json entry. This is probably the simplest way of using the script: edit a task, press F5, the task is invoked. If you have set some breakpoints then they break into the debugger when hit, otherwise the task just works.
Alternatively, you can invoke the script directly from the integrated console or register it as one of PowerShell.ShowAdditionalCommands and choose it there.
How to register commands. Create or open your VSCode profile (see $profile
)
and add one or two commands:
Register-EditorCommand -Name IB1 -DisplayName 'Invoke task' -ScriptBlock {
Invoke-TaskFromVSCode.ps1
}
Register-EditorCommand -Name IB2 -DisplayName 'Invoke task in console' -SuppressOutput -ScriptBlock {
Invoke-TaskFromVSCode.ps1 -Console
}
NB You can add a keyboard shortcut for PowerShell.ShowAdditionalCommands.
- Concepts
- Script Tutorial
- Incremental Tasks
- Partial Incremental Tasks
- How Build Works
- Special Variables
- Build Failures
- Build Analysis
- Parallel Builds
- Persistent Builds
- Portable Build Scripts
- Using for Test Automation
- Debugging Tips
- VSCode Tips
Helpers
- Invoke Task from VSCode
- Generate VSCode Tasks
- Invoke Task from ISE
- Resolve MSBuild
- Show Build Trees
- Show Build Graph
- Argument Completers
- Invoke-Build.template
Appendix