Skip to content
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

Make module manifest v2 compatible #263

Merged
merged 1 commit into from
Mar 7, 2016

Conversation

theaquamarine
Copy link
Collaborator

The RootModule key was renamed from ModuleToProcess in PowerShell v3
so is not compatible with PowerShell v2. ModuleToProcess still exists
as an alias, so use that instead.

See discussion in #242

The RootModule key was renamed from ModuleToProcess in PowerShell v3
so is not compatible with PowerShell v2. ModuleToProcess still exists
as an alias, so use that instead.

See discussion in dahlbyk#242
@shiftkey
Copy link
Contributor

shiftkey commented Mar 7, 2016

Just tested this out on a Win7 VM with PowerShell v2:

C:\Users\shiftkey\Documents\GitHub\posh-gitPS>git checkout v2manifest
Switched to branch 'v2manifest'
Your branch is up-to-date with 'theaquamarine/v2manifest'.
C:\Users\shiftkey\Documents\GitHub\posh-gitPS>.\install
Adding posh-git to profile...
posh-git sucessfully installed!
Please reload your profile for the changes to take effect:
. $PROFILE
C:\Users\shiftkey\Documents\GitHub\posh-gitPS>. $PROFILE
WARNING: posh-git support for PowerShell 2.0 is deprecated; you have version 2.0.
To download version 3.0, please visit https://www.microsoft.com/en-us/download/details.aspx?id=34595
For more information and to discuss this, please visit #163
To suppress this warning, change your profile to include 'Import-Module posh-git -Args $true'.
C:\Users\shiftkey\Documents\GitHub\posh-git [v2manifest ≡]>

And this is what I currently get on master when I do the same:

PS C:\Users\shiftkey\Documents\GitHub\posh-git> .\install.ps1
Adding posh-git to profile...
posh-git sucessfully installed!
Please reload your profile for the changes to take effect:
. $PROFILE
PS C:\Users\shiftkey\Documents\GitHub\posh-git> . $PROFILE
Import-Module : The 'C:\Users\shiftkey\Documents\GitHub\posh-git\posh-git.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList',
'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Remove the members that are not valid ('RootModule'), then try to import the module again.
At C:\Users\shiftkey\Documents\GitHub\posh-git\profile.example.ps1:4 char:14

  • Import-Module <<<< .\posh-git
    • CategoryInfo : InvalidData: (C:\Users\shiftk...t\posh-git.psd1:String) [Import-Module], InvalidOperationException
    • FullyQualifiedErrorId : Modules_InvalidManifestMember,Microsoft.PowerShell.Commands.ImportModuleCommand

The term 'Start-SshAgent' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\shiftkey\Documents\GitHub\posh-git\profile.example.ps1:25 char:15

  • Start-SshAgent <<<< -Quiet
    • CategoryInfo : ObjectNotFound: (Start-SshAgent:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

👍 to this change, will test some other OSes as well while I'm in here...

@dahlbyk
Copy link
Owner

dahlbyk commented Mar 7, 2016

I'll defer to @shiftkey's test matrix on this.

works on my machine

@shiftkey
Copy link
Contributor

shiftkey commented Mar 7, 2016

I'll wrap this up today, haven't found any shockers so far

@dahlbyk
Copy link
Owner

dahlbyk commented Mar 7, 2016

Is this the only PowerShell 2 incompatibility you've seen so far?

@dahlbyk
Copy link
Owner

dahlbyk commented Mar 7, 2016

N.B. New-ModuleManfest docs for -RootModule document the alias.

Note: In Windows PowerShell 2.0, this key was called "ModuleToProcess." You can use the "RootModule" parameter name or its "ModuleToProcess" alias.

I'm going to go ahead and merge. Please open another issue if you find other ways we could be less PS2-hostile.

dahlbyk added a commit that referenced this pull request Mar 7, 2016
Make module manifest v2 compatible
@dahlbyk dahlbyk merged commit a2be688 into dahlbyk:master Mar 7, 2016
@theaquamarine theaquamarine deleted the v2manifest branch February 8, 2020 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants