-
-
Notifications
You must be signed in to change notification settings - Fork 59
Invoke Task from ISE
The script Invoke-TaskFromISE.ps1 invokes the current task from the build script being edited in PowerShell ISE. It is invoked either in ISE or in PowerShell console.
The current task is the task found at the caret line or above. If nothing is found, e.g. the caret is in the beginning of the file, then the default task is invoked. The current file is saved if it is modified.
If the build fails when the task is invoked in ISE and the error location is in the same build script then the caret is automatically moved to the error position.
This script may be called directly from the console pane. But it is easier to
use associated with key shortcuts. For example, in order to invoke it in ISE by
[Ctrl+Shift+T]
and in console by [Ctrl+Shift+B]
add the following lines to
the ISE profile:
# Invoke task in ISE by Invoke-Build.ps1
$null = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(
'Invoke Task in ISE', {Invoke-TaskFromISE.ps1}, 'Ctrl+Shift+T')
# Invoke task in console by Invoke-Build.ps1
$null = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(
'Invoke Task in Console', {Invoke-TaskFromISE.ps1 -Console}, 'Ctrl+Shift+B')
These commands assume that Invoke-TaskFromISE.ps1 is in the path. If this is not the case then specify the full script path there.
To get the ISE profile path, type $profile
in the console pane:
PS> $profile
C:\Users\...\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1
- 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