We released a new service build of PowerShell Studio 2018 (v5.5.154). This service build is included as part of the regular update cycle for our subscribers.
This service release adds PowerShell Core (V6) support and introduces several new project features.
PowerShell Core (V6) Support
We are happy to announce added support for PowerShell Core (V6). Now you can select PowerShell Core from the platform selection in the ribbon (Home > Platform):
Note: PowerShell Studio automatically detects preview and release versions of PowerShell Core and displays them in the platform list.
The new platform settings allow you to run PowerShell Core scripts directly from PowerShell Studio:
Important: Debugging and caching for PowerShell Core is not available at this time. For syntax coloring, PowerShell Studio will use the PowerShell V5 cmdlet cache as a fall back.
PowerShell Core Consoles
In regards to the embedded consoles, if you install a new version of PowerShell Core, you will need to reset your consoles to see the new version in the console panel:
If you don’t want to reset any custom settings, then you will have to manually update the path to the PowerShell Core executable.
This release introduces several new project specific features.
Module Projects – Auto Export Functions and PS1XML files
The new auto export features for module projects makes managing your manifest exports easier than ever.
New Module Project Properties:
|Auto Export Functions||Handles function exports automatically.|
|Auto Export PS1XML Files||Handles ps1xml exports automatically.|
Auto Export Functions
If set to True, on build, the module project will update the manifest’s FunctionsToExport field with a list of exported functions. To determine which functions are exported, the module project files have a new Export Functions property that determines if functions defined in the file are exported:
Project File – Export Functions Property
If a project file’s Export Functions property is set to True, PowerShell Studio will use the functions defined in the file to update the manifest’s FunctionsToExport value.
This property allows you to organize your functions into files that are public (exported) and private (not exported). Once configured, you do not need to manually update the manifest when you add, remove, or renamed a function.
Auto Export PS1XML Files
If set to True, on build, the module project will update the manifest’s TypesToProcess and FormatsToProcess fields with the list of ps1xml files contained within the project.
Depending on the file’s name, PowerShell Studio will determine which field to use:
Note: The ps1xml file must be part of the project and its Build property must be set to Content in order for it to be included in the manifest.
When you Build the module project the manifest is now updated automatically, thus alleviating the previous requirement to manually update the manifest.
The new project file Build Order property allows you to determine the order in which project files are merged into the final project script. This setting only applies to project files with the Build property set to Include.
The build order can be important when the content of one project file is dependent on the content of another file. For example, when dealing with class inheritance in PowerShell, you must make sure the base class is defined before declaring any classes that inherit from that base class. By setting the build order of the individual class files, you can ensure that the final script includes the base class definition before the inherited class definition.
Another use case would be when functions or global variables are defined within a global file (Shared = True). To ensure those declarations are defined before invoking, the build order index should be set to a value lower than that of the dependent project files.
Set the build order of project files by modifying the zero-based index of each project file. An index of 0 ensures that the file will be the first one merged into the generated script.
There are some exceptions to the build order:
– In a module project, the primary psm1 file’s content is included at the end of the generated script regardless of its Build Order property value.
– Collection projects only support project files with Build = Content, therefore the Build Order property is not applicable.
Project Sync on Activate
We included a new option, Sync files when the application is activated, that allows you to trigger project file synchronization when the application regains focus (activated).
Options > General > Project:
Note: In order for this feature to work, you must have a project opened with file synchronization enabled (Synchronized = True):
This option ensures that the application can detect changes when you are making modifications to the project’s folder structure outside of PowerShell Studio.
Note: We updated the synchronization messages to use + and – for adding and removing file messages.
Windows Service Project Template
This service release includes the new Windows Service Project template which allows you to create a Windows service script using a project:
Some benefits of using a project verses a single file script are the ability to manage additional content, and also to organize your script into individual script files to make your code more manageable.
The Windows Service Project utilizes the same predefined functions used by the single file Windows Service Script template.
PowerShell Browser – Distinguishing Command Types
We updated the PowerShell Brower in the Object Browser Panel, so that the icons visually distinguish functions, workflows, and cmdlets:
This change helps surface the true command types of the module. In addition, the PowerShell Browser now retains your selection when switching between PowerShell platforms.
PS1XML Type Caching
PowerShell Studio now caches ps1xml type files, which allows PowerShell Studio’s PrimalSense to display extended type properties and methods without executing the script.
Please continue providing your feedback. Many of the new features included in the service builds are suggestions from users like you. Submit your suggestions or feature requests on the Wish List and Feature Requests forum or the new Feature Requests page.
You can view the complete service build log here.