-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Thanks for collecting so many PowerShell module build features in one place - I really appreciate this module and the well-thought collection of tasks/variables!
I spent a few minutes looking and didn't find any mention of the intended PowerShell version compatibility, so apologies if this has already been covered. I have a PowerShell 5.1 project that cannot be migrated to PowerShell 7, and the INIT task throws an exception when called from a Windows Powershell session.
I know it can add a lot of effort to maintain backward compatibility so I 100% understand if a conscious choice is made to forego support for Windows PowerShell / PowerShell 5.1. Since this looked to be the only barrier to using PowerShellBuild with my module I thought I'd ask.
Expected Behavior
PowerShellBuild tasks are compatible with PowerShell 5.1 as well as versions based on .NET 5+
Current Behavior
The following exception is thrown during the INIT task
Error: 9/7/2021 11:41:13 AM:
At ~\Documents\WindowsPowerShell\Modules\PowerShellBuild\0.6.1\psakeFile.ps1:19 char:5 + Initialize-PSBuild -UseBuildHelpers -BuildEnvironment $PSBPrefere ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Method invocation failed because [System.IO.Path] does not contain a method named 'IsPathFullyQualified'.
Possible Solution
Out of an abundance of laziness, I switched from the IsPathFullyQualified() method to IsPathRooted() in Initialize-PSBuild.ps1 which is available in both PowerShell 5.1 and PowerShell 7. I know there's a difference between the two, so a better solution would probably involve creating a private function to reimplement the IsPathFullyQualified() functionality in a way that is compatible between 5.1 and 7+.
Steps to Reproduce (for bugs)
- Create a new module with Stucco
- Execute .\build.ps1 from a Windows PowerShell terminal
Context
I'm refactoring the build process for a PowerShell 5.1 module which is a wrapper for an SDK based on .NET Framework. I already use psake and PowerShellBuild allows me to drop a lot of boilerplate. Once I modified the Initialize-PSBuild function it worked flawlessly.
Your Environment
- Module version used: 0.6.1
- Operating System and PowerShell version: Windows 10 with PowerShell 5.1
- Running .\build.ps1 from the Stucco template