-
-
Notifications
You must be signed in to change notification settings - Fork 59
Invoke Task from VSCode
The script Invoke-TaskFromVSCode.ps1 invokes the current task from the build script being edited in VSCode. It is invoked either in the VSCode session or in an external PowerShell console.
The script requires the VSCode PowerShell extension installed.
The current task is the task at the caret line or above. If none is found then the default task is invoked. Currently the script should be saved manually before invoking (#258).
In order to register editor commands create or open the VSCode profile:
C:\Users\...\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1
and add two commands:
Register-EditorCommand -Name IB -DisplayName 'Invoke task' -ScriptBlock {
param($Context)
Invoke-TaskFromVSCode.ps1
}
Register-EditorCommand -Name IBConsole -DisplayName 'Invoke task in console' -SuppressOutput -ScriptBlock {
param($Context)
Invoke-TaskFromVSCode.ps1 -Console
}
These commands assume that Invoke-TaskFromVSCode.ps1 is in the path. If this is not the case then specify the full script path.
In order to invoke these commands in VSCode, press F1 or Ctrl+Shift+P to open the command palette. Type the characters addi until you see the item PowerShell: Show Additional Commands. Choose the command and press Enter.
- 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