New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current module manifest schema is not adequate to properly support cross-platform modules #5541
Comments
I originally proposed allowing variables like ExportedCmdlets = @(
'Get-Thing'
if ($IsLinux) { 'Get-LinuxThing' }
) Untested, but I think all that is needed is to add to this list. |
A complementary aspect is how to restrict a module to an edition / a (set of) platform(s):
(Note that edition support and platform support are independent dimensions; conceivably, modules can run on both editions while requiring Windows as the platform. |
I would like to contribute and make a PR for this issue :
Anything else ? |
That sounds like a good start, go for it! 😄 |
I would like to add PSVersionTable too, someone against that ? |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
1 similar comment
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
It is not going to be uncommon for module authors to want to provide slightly different functionality on different operating systems e.g. the module provides 30 commands, two of which only work on Windows PowerShell. Right now, there is no good way to declare "conditional" module exports in the manifest where the condition is the OS platform.
In fact, even
PowerShellVersion
is problematic if you design your module to load into both Windows PowerShell and PowerShell Core. Which PowerShell version does that refer to? Windows PowerShell? PowerShell Core? What if at some point, on PS Core I require 6.1.0? Does that mean my module can't load into Windows PowerShell 5.x anymore - probably. But I may not be providing that functionality when I'm loaded into Windows PowerShell (runtime decision) so Win PS 5.1 should be allowed when loading into Windows PowerShell.AFAICT all of these field's values may be conditional upon the OS platform and/or the PowerShell platform (Win or Core)
In order to make any changes backwards compatible with existing Windows PowerShell instance, we could put all the conditional declarations in PrivateData. This implies that fields not in PrivateData inherently apply to Windows PowerShell when module is loaded by Windows PowerShell. PowerShell Core could be modified to process the conditional fields in PrivateData. What might those look like? Maybe this?
This doesn't take into account Nano server which I don't have enough experience with to take it into account. Anyway, this is just something to get the conversation started.
Long term, this approach seems less than ideal - burying so much important metadata under
PrivateData
.The text was updated successfully, but these errors were encountered: