PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Install-Module does not respect ModuleVersion or Guid for Required Modules

Open MarkDordoy opened this issue 3 years ago • 3 comments

I use an artifactory server with a nuget repository setup with an internally published location and a cache to psgallery. The end result of this means im able to register a single PSRepository and install both external and internally published modules.

However we have an internal module created called PSLogger which classes with the one found in PSGallery.

I have a module that i wrote that depends on our internal version of PSLogger so I have it included in my manifest file as seen below:

    RequiredModules      = @(
        @{ModuleName = 'Az.Accounts'; ModuleVersion = '2.2.6'; GUID = '17a2feff-488b-47f9-8729-e2cec094624c' },
        @{ModuleName = 'PSLogger'; ModuleVersion = '1.0.8'; GUID = 'f892af3d-d369-4eb5-a48a-80017115142f }
    )

For the purpose of this ticket, lets say my module is called MarksModule. When I run Install-Module -Name MarksModule -verbose -Repository 'Artifactory' It will install az.Accounts as expected, it will also install PSLogger, however it ignores the version and guid as it goes and installs this version found here (https://www.powershellgallery.com/packages/PSLogger/1.4.3)

I can confirm PSLogger version 1.0.8 is published to my artifactory repo, however when i download the raw nupkg file and extract the nuspec file i can see the version is correct, but the guid gets dropped.

So there are possibly two issues here, one is the publish doesnt seem to embed the guid into the nuspec file, and 2nd the install-module command ignores version (and guid if it checks the psd1 file)

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.610
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.610
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

MarkDordoy avatar Mar 09 '21 14:03 MarkDordoy

Thanks @MarkDordoy we will try to address this in newer versions of the module

SydneyhSmith avatar Mar 11 '21 19:03 SydneyhSmith

We have a similar issue with ModuleVersion (not using Guid). See here: https://stackoverflow.com/questions/73907636/powershell-module-install-always-installs-latest-dependency-version

Is this relared, or should it be raised as a new issue?

Richard-Payne avatar Sep 30 '22 11:09 Richard-Payne

Hi all, @Richard-Payne that issue is likely the same issue as the one @MarkDordoy originally reported. We'll likely have a fix for this out within the next two preview releases. Thanks for the report and update!

alerickson avatar Oct 10 '22 18:10 alerickson

Does it work if you specify RequiredVersion instead in your RequiredModules?

et1975 avatar Nov 04 '22 14:11 et1975