Skip to content

Unable to publish-module to NuGet with a required module dependency #843

@mmisztal1980

Description

@mmisztal1980

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

I'm working on emitting powershell modules from a github repo to nuget. My repo contains 2 modules:

  • A: CloudTek.Automation.Shell
  • B: CloudTek.Automatuon.K8S

B has a dependency on previously published version of A, therefore I've added it to it's RequiredModules . I've encountered a problem during Publish-Module and I'm attempting to solve it. If my understanding is correct, in order to successfully publish B with Publish-Module, A needs to be installed locally 1st as indicated here.

In my CI I'm using PowershellGet 3.0.17-beta17.

Expected behavior

I'm expecting `Install-Module` on A to succeed while installing B locally from a path on the local filesystem of a GitHub actions runner (ubuntu-latest), so that I can execute `Publish-Module` on B in the next step.

Actual behavior

The pipeline fails as seen here

Line |
   2 |  ./Publish.ps1 `
     |  ~~~~~~~~~~~~~~~
     | Failed to publish module CloudTek.Automation.K8S :   The specified
     | RequiredModules entry 'CloudTek.Automation.Shell' in the module manifest
     | '/home/runner/work/automation/automation/src/CloudTek.Automation.K8S/CloudTek.Automation.K8S.psd1' is invalid. Try again after updating this entry with valid values.

Error details

Exception             : System.Exception: No match was found for the specified 
                        search criteria and module name 'CloudTek.Automation.Sh
                        ell'. Try Get-PSRepository to see all available registe
                        red module repositories.
TargetObject          : Microsoft.PowerShell.PackageManagement.Cmdlets.InstallP
                        ackage
CategoryInfo          : ObjectNotFound: (Microsoft.PowerShel…lets.InstallPackag
                        e:InstallPackage) [Install-Package], Exception
FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageMan
                        agement.Cmdlets.InstallPackage
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Install-Module<Process>, /home/runner/.local/share/p
                        owershell/Modules/PowerShellGet/2.2.5/PSModule.psm1: li
                        ne 9711
                        at <ScriptBlock>, /home/runner/work/automation/automati
                        on/src/CloudTek.Automation.K8S/PrePublish.ps1: line 16
                        at <ScriptBlock>, /home/runner/work/automation/automati
                        on/src/CloudTek.Automation.K8S/PrePublish.ps1: line 7
                        at <ScriptBlock>, /home/runner/work/automation/automati
                        on/scripts/Publish.ps1: line 31
                        at <ScriptBlock>, /home/runner/work/_temp/476525ff-140e
                        -429e-810c-50cafc565387.ps1: line 2
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

Environment data

Key   : PSVersion
Value : 7.2.6
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.2.6
Name  : GitCommitId


Key   : OS
Value : Linux 5.15.0-1022-azure #27~20.04.1-Ubuntu SMP Mon Oct 17 02:03:50 UTC 
        2022
Name  : OS


Key   : Platform
Value : Unix
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions