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

Cannot publish module with a pre-release dependency #517

Closed
matteo-prosperi opened this issue Aug 2, 2019 · 12 comments
Closed

Cannot publish module with a pre-release dependency #517

matteo-prosperi opened this issue Aug 2, 2019 · 12 comments

Comments

@matteo-prosperi
Copy link

I have published a module with the following version numbering

    # Module manifest for module 'MyBaseModule'
    ModuleVersion = '3.3.500'

    GUID = '0f1488f1-241b-4a0c-80cc-9f3f69d81818'

    PrivateData = @{
        PSData = @{
            Prerelease = 'beta0'
        }
    }

This shows upon the gallery as version 3.3.500-beta0, as expected.
When I try to Publish-Module for a second module which is dependent on the first

    # Module manifest for module 'MyDependentModule'

    RequiredModules = @(
        @{
            ModuleName = 'MyBaseModule';
            RequiredVersion = '3.3.500';
            Guid = '0f1488f1-241b-4a0c-80cc-9f3f69d81818' }
    )

    ModuleVersion = '3.3.500'

    PrivateData = @{
        PSData = @{
            Prerelease = 'beta0'
        }
    }

I get an error complaining that MyBaseModule is not available on the gallery.
It is worth noting that the modules actually import correctly when used locally.

If I try to change the RequiredVersion to

            RequiredVersion = '3.3.500-beta0';

then Publish-Module gives me an error saying that '3.3.500-beta0' is not a valid version number.

@SteveL-MSFT
Copy link
Member

The problem is that RequiredVersion is not semver compatible so there's no way to specify a prerelease version. Related PowerShell/PowerShell#2983

@viralmodi
Copy link

@SteveL-MSFT @matteo-prosperi We are seeing this same issue about unable to Install or Publish pre-release modules which depend on other pre-release modules. Is there any resolution to this? If not, what are the possible workarounds?

@alerickson
Copy link
Member

@viralmodi linking to this issue regarding a workaround for publish.

What module are you trying to install? I'd like to test if there's a work around for this but can't easily find a module with a prerelease dependency.

@viralmodi
Copy link

viralmodi commented May 20, 2020

@alerickson Its a work-related module internal (pre-release) to our office. It depends on another internal (pre-release) module. I can't share any of it. You could create a couple of helloworld modules, add pre-release tags, make one dependent on another by adding a manifest file and test it.

@alerickson
Copy link
Member

alerickson commented May 20, 2020

@viralmodi do you still have the issue if the dependencies are installed before the module?

@viralmodi
Copy link

@alerickson We maintain an internal version of our tools and an external version. The internal version or the pre-release version carries pre-release feature which get released as per the release cadence. The employees in our company have access to all pre-release features. Our pre-release versions are tagged as <-preview.build_id>. Our release versions are tagged as This is the use case for which we are facing a problem since some of our pre-release version module is dependent on another pre-release version module.
As for your second question, it doesn't work. It still complaints about "Unable to resolve module dependency"

@matteo-prosperi
Copy link
Author

@viralmodi I was not able to find a workaround. I simply released the prerelease modules with "normal" versioning marking them as prerelease in the module description.

@alerickson
Copy link
Member

@viralmodi the current preview release of PowerShellGet v3 should address this issue since we handle semver syntax: https://www.powershellgallery.com/packages/PowerShellGet/3.0.0-beta3 .
I can't think of any workarounds that would be appropriate for you situation.

I'm currently working on publishing functionality for v3 as well, so that should be out in the next couple of weeks and address the corresponding issue with publish-module.

@viralmodi
Copy link

@alerickson Thanks. We will try out the PowerShellGet v3 and let you know. Will wait for your fix in Publish functionality as well.

@viralmodi
Copy link

@alerickson PowershellGet v3 will be default in which powershell versions? We are thinking of using some other workarounds for versioning of our preview product for internal users so they do not have to rely on PowershellGet v3 install to install our cmdlets.

@kumbham
Copy link

kumbham commented Jun 27, 2020

@alerickson is there an update on the Publish module? I'm still facing the following issue with the latest PowershellGet v3 module.

Publish-Module @publishArgs

The 'RequiredModules' member is not valid in the module manifest file '*.psd1': Cannot convert value "System.Collections.Hashtable" to type
      | "Microsoft.PowerShell.Commands.ModuleSpecification". 
Error: "Cannot convert value "0.2.0-1" to type "System.Version". Error: "Input string was not in a correct format.""

@SteveL-MSFT
Copy link
Member

v3 beta10 fixes this issue. I don't believe we'll spend time fixing this in v2.

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

6 participants