Title: PowerShellGet needs to check compatibility before installing a script or module · Issue #528 · PowerShell/PowerShellGetv2 · GitHub
Open Graph Title: PowerShellGet needs to check compatibility before installing a script or module · Issue #528 · PowerShell/PowerShellGetv2
X Title: PowerShellGet needs to check compatibility before installing a script or module · Issue #528 · PowerShell/PowerShellGetv2
Description: For reference, see the discussion on PowerShell/PowerShell#10318. That PR ensures that the workflow keyword results in a parse error. If you build that PR and run it, and try to run the PowerShellGet tests, you get an error when one of t...
Open Graph Description: For reference, see the discussion on PowerShell/PowerShell#10318. That PR ensures that the workflow keyword results in a parse error. If you build that PR and run it, and try to run the PowerShellG...
X Description: For reference, see the discussion on PowerShell/PowerShell#10318. That PR ensures that the workflow keyword results in a parse error. If you build that PR and run it, and try to run the PowerShellG...
Opengraph URL: https://github.com/PowerShell/PowerShellGetv2/issues/528
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PowerShellGet needs to check compatibility before installing a script or module","articleBody":"For reference, see the discussion on [PowerShell/PowerShell#10318](https://github.com/PowerShell/PowerShell/pull/10318).\r\n\r\nThat PR ensures that the `workflow` keyword results in a parse error. If you build that PR and run it, and try to run the PowerShellGet tests, you get an error when one of the tests tries to install `Fabrikam-ServerScript` from `www.poshtestgallery.com`. The error occurs because that script has a `workflow` defined within it, and that no longer parses, so the installation fails. The error occurs when PowerShellGet tries to get the script info, which requires parsing the script, which won't work in PowerShell 7.\r\n\r\nThe simple solution to this is for PowerShellGet to check if a script/module has workflow in it _before_ it tries to install it, and prevent that installation from happening with an appropriate error message in `PowerShell 6+`. Users can still save the script (this does not do any parsing checks), but they won't be able to install such a script, and they'll know why because the error message will tell them the script includes a PowerShell workflow, which is not supported on PowerShell 6 or later.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```powershell\r\n# Note you need to register www.poshtestgallery.com as a repo and save\r\n# the repo's name in $repoName before you run this command on\r\n# PowerShell 6 or later.\r\nInstall-Script Fabrikam-ServerScript -Repository $repoName\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nAn error message indicating that the script cannot be installed because it contains PowerShell workflow, which is not available in PowerShell 6 or later.\r\n\r\nActual behavior\r\n---------------\r\n\r\nOn PowerShell 6, the script installs.\r\n\r\nOn PowerShell 7 with the PR code: an error is generated because the script does not parse.\r\n\r\nEnvironment data\r\n----------------\r\n\r\n```powershell\r\n\u003e $PSVersionTable\r\nName Value\r\n---- -----\r\nPSVersion 7.0.0-preview.2\r\nPSEdition Core\r\nGitCommitId 7.0.0-preview.2-63-g00949ab3522c66bc2efdcb62779d64c7546a5830\r\nOS Microsoft Windows 10.0.17763\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n\r\n```powershell\r\n\u003e Get-Module -ListAvailable PowerShellGet,PackageManagement\r\n Directory: C:\\Users\\kirka\\OneDrive\\Documents\\PowerShell\\Modules\r\n\r\nModuleType Version PreRelease Name PSEdition ExportedCommands\r\n---------- ------- ---------- ---- --------- ----------------\r\nScript 1.4.3 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}\r\nScript 2.2 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}\r\n\r\n Directory: C:\\Program Files\\PowerShell\\Modules\r\n\r\nModuleType Version PreRelease Name PSEdition ExportedCommands\r\n---------- ------- ---------- ---- --------- ----------------\r\nScript 1.4 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}\r\nScript 1.2.3 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}\r\nScript 1.1.7.2 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}\r\nScript 2.1.4 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}\r\nScript 2.0.3 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}\r\nScript 2.0.0 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}\r\n\r\n Directory: C:\\users\\kirka\\source\\repos\\powershell\\src\\powershell-win-core\\bin\\debug\\netcoreapp3.0\\win7-x64\\publish\\Modules\r\n\r\nModuleType Version PreRelease Name PSEdition ExportedCommands\r\n---------- ------- ---------- ---- --------- ----------------\r\nScript 1.4.3 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}\r\nScript 2.2 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}\r\n```\r\n\r\n```powershell\r\n\u003e Get-PackageProvider -ListAvailable\r\nName Version DynamicOptions\r\n---- ------- --------------\r\nNuGet 3.0.0.1 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate\r\nPowerShellGet 2.2.0.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, Includes, DscResource, RoleCapability, Command, Acce…\r\nPowerShellGet 2.1.4.0\r\nPowerShellGet 2.0.3.0\r\nPowerShellGet 2.0.0.0\r\n```\r\n","author":{"url":"https://github.com/KirkMunro","@type":"Person","name":"KirkMunro"},"datePublished":"2019-08-19T16:53:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/528/PowerShellGetv2/issues/528"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dd35acf6-714e-180d-7b9c-faf22dee2ded |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 85B0:18991A:A60AF7:ED94A8:6A59F91F |
| html-safe-nonce | 647bca039457fbc501042652e683a63dc6f4f44a5c4fefda78daab28355b095a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUIwOjE4OTkxQTpBNjBBRjc6RUQ5NEE4OjZBNTlGOTFGIiwidmlzaXRvcl9pZCI6IjUxNjk1MzcxNjAyNTc4NjE5MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b63c0c0628d983c5a31c99a2d97e853591624bb849a8e11e0350489c469662fc |
| hovercard-subject-tag | issue:482420129 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShellGetv2/528/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fd30178a3a82fe80fcf70afa8a22356ef024aedf8fe640e8b4dd84f8682e5e1e/PowerShell/PowerShellGetv2/issues/528 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fd30178a3a82fe80fcf70afa8a22356ef024aedf8fe640e8b4dd84f8682e5e1e/PowerShell/PowerShellGetv2/issues/528 |
| og:image:alt | For reference, see the discussion on PowerShell/PowerShell#10318. That PR ensures that the workflow keyword results in a parse error. If you build that PR and run it, and try to run the PowerShellG... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KirkMunro |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShellGetv2 git https://github.com/PowerShell/PowerShellGetv2.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 57910460 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShellGetv2 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 57910460 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShellGetv2 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 24801cf86623a319252348d1fd69122ad974b842 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width