PowerShell / PowerShell/PSResourceGet

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

Open
#349 6 comments 1 reaction 1 assignee View on GitHub

@anamnavi is already working on this.

Since Oct 10, 2022.

Area-Install Issue-Enhancement Needs-Triage
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.