If you've been writing PowerShell custom actions for your Advanced Installer projects, chances are the Windows PowerShell ISE has been your editor of choice for years - it was for me, at least.
After lurking on the PowerShell subreddit, I found a post that mentioned that PowerShell ISE has been renamed to PowerShell ISE 5.1.
The first comment linked to the Microsoft documentation page regarding this:
The Windows PowerShell ISE
where it is explicitly mentioned that the ISE is no longer in active feature development.
The ISE is still shipped with Windows and you can still open it today. What it does mean is that Microsoft has stopped adding features to it, and it will not be updated to support anything beyond Windows PowerShell 5.1.
On the other hand, PowerShell 7, the actively developed, cross platform version, simply will not run inside the ISE. Microsoft's own documentation confirms this and recommends Visual Studio Code with the PowerShell extension as the replacement.
This is why I decided to create this article with the hope of helping you set up Visual Studio Code for PowerShell development.
Here are the steps we need to take:
- Download and install PowerShell 7 from the official GitHub releases page. It installs side by side with Windows PowerShell 5.1, so nothing existing is affected.
- Download and install Visual Studio Code.
- Open the Extensions view (Ctrl+Shift+X), search for "PowerShell" and install the extension published by Microsoft.
- Open, or create, a .ps1 file. The extension picks this up automatically and gives you syntax highlighting, IntelliSense and an Integrated Console, which is the closest equivalent to the ISE's script pane and console pane combo.
Here are some useful things that are identical in VSCode as they were in the ISE:
1. F5 to run the whole script / F8 to run a selection --> same shortcuts in VS Code.
2. Setting breakpoints by clicking in the margin --> identical, and the debugging experience (call stack, variables pane, watch expressions) is more capable than the ISE's.
These are two that I could think of at this moment - if you have anything else in mind, drop it down below.
One more thing: the Session object is now available in PowerShell custom actions
Advanced Installer 23.8 added direct access to the Windows Installer Session object from PowerShell custom actions, closing the gap that used to keep some of you on VBScript (which is deprecated) or force you away from Script Type custom actions to DLL/EXE custom actions.
We had lots of people asking for this support, especially since the deprecation of VBScript and we finally managed to deliver it.
Hope this helps!
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging