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

Publish-Module, Save-Module and Install-Module do not work with pre-release module, which depends on another pre-release module #85

Closed
kamennikolov opened this issue Feb 2, 2018 · 8 comments

Comments

@kamennikolov
Copy link

We're trying to make a pre-release of our product which contains multiple modules, that depend on each other. We can successfully publish the first pre-release module which has no dependencies, but when we upload the next one, which depends on the we get an error saying that:
Publish-PSArtifactUtility : PowerShellGet cannot resolve the module dependency 'VMware.VimAutomation.Sdk' of the module
'VMware.VimAutomation.Common' on the repository 'PSGallery'. Verify that the dependent module 'VMware.VimAutomation.Sdk' is available in the
repository 'PSGallery'. If this dependent module 'VMware.VimAutomation.Sdk' is managed externally, add it to the ExternalModuleDependencies entry in the PSData section of the module manifest."

It turns out that the -AllowPreRelease parameter is not properly propagated down the stack. Even after we fixed Publish-Module locally and managed to upload all the modules Save-Module and Install-Module do not work for the same reason. Customers will only be able to download the first module, which has not dependencies.

Expected Behavior

Module should publish and install without errors.

Current Behavior

Publish-PSArtifactUtility : PowerShellGet cannot resolve the module dependency 'VMware.VimAutomation.Sdk' of the module
'VMware.VimAutomation.Common' on the repository 'PSGallery'. Verify that the dependent module 'VMware.VimAutomation.Sdk' is available in the
repository 'PSGallery'. If this dependent module 'VMware.VimAutomation.Sdk' is managed externally, add it to the ExternalModuleDependencies entry in the PSData section of the module manifest."

Possible Solution

-AllowPreRelease parameter should be properly propagated down the stack

Steps to Reproduce (for bugs)

Find-Module VMware.PowerCLI -AllowPrerelease | Install-Module

Context

We're trying to make a pre-release of our product which contains multiple modules, that depend on each other.

Your Environment

PS C:\windows\system32> $PSVersionTable

Name Value


PSVersion 5.1.15063.786
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.786
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

PS C:\windows\system32> Get-Module -ListAvailable PowerShellGet,PackageManagement

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version Name ExportedCommands


Script 1.1.7.0 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script 1.6.0 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}

PS C:\windows\system32> Get-PackageProvider

Name Version DynamicOptions


msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
NuGet 2.8.5.210 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet 1.6.0.0 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent

@alerickson alerickson transferred this issue from PowerShell/PowerShellGetv2 Mar 30, 2020
@kumbham
Copy link

kumbham commented May 19, 2020

@SydneyhSmith @kamennikolov I ran into a similar issue where I'm trying to publish a module that depends on a pre-release version of another module. Publish-Module throws No match was found for the specified search criteria and module name .. error. Are there any workarounds to resolve this problem?

@kamennikolov
Copy link
Author

@kumbham we fixed Publish-Module locally and managed to upload.

@kumbham
Copy link

kumbham commented May 19, 2020

@kamennikolov thanks for the response. Do you mind sharing me few pointers on where and how can I fix it?

@dmilov
Copy link

dmilov commented May 20, 2020

@kamennikolov thanks for the response. Do you mind sharing me few pointers on where and how can I fix it?

It was back in 2018. We used PowerShellGet 1.6 then. The problem was in the ValidateAndGet-RequiredModuleDetails function of PSModule.psm1

The fix we did locally to be able to publish the prerelease modules was at line 8607 of PSModule.psm1 which calls Find-Module with splatting @FindModuleArguments. The FindModuleArguments hashble is defined 3 lines above at 8604 and the only parameter in it is the Name of the module. That is breaking the validation. -AllowPrerelease has to be specified on the Find-Module to be able to discover the published prerelease module dependencies.

The fix I did then was to replace

Find-Module @FindModuleArguments

with

Find-Module -Name $ModuleName -AllowPrerelease

another option is to add AllowPrerelease key with $true in the FindModuleArguments hashtable

The fix shouldn't have affect non prerelease modules it should work for them as well.

@TanmayDharmaraj
Copy link

A similar issue arises when I perform Save-Module as well.

@SteveL-MSFT SteveL-MSFT added this to the vNext milestone Sep 4, 2020
@SteveL-MSFT SteveL-MSFT removed the vNext label Sep 4, 2020
@SteveL-MSFT SteveL-MSFT modified the milestones: vNext, 3.0-Consider Sep 4, 2020
@SteveL-MSFT
Copy link
Member

I agree that AllowPrerelease should be propagated to other calls once specified by the user or if they specify a specific version string that includes prerelease. Note that a stable module that depends on prerelease dependencies is not a pattern we want to support so that should continue to fail.

@SteveL-MSFT
Copy link
Member

This is fixed via beta10

@darksidemilk
Copy link

Is there any chance of this fix being added as a patch to 2.x ?
I realized that there's been a stop on development and whatnot, but it would be very helpful in our migration path to powershellget 3 and powershell 7 if we could handle these preRelease depdendencies on our current modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants