Skip to content

Publish-PSResource does not take into account ExternalModuleDependencies, when checking dependencies #1245

@peetrike

Description

@peetrike

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

New-PSScriptFileInfo -Description 'just for test' -RequiredModules @{ModuleName='Hyper-V'} -ExternalModuleDependencies 'Hyper-V' -Path test.ps1

Publish-PSResource -Path .\test.ps1 -Repository local

Expected behavior

script is published

Actual behavior

publish-psresource : Dependency 'Hyper-V' was not found in repository 'local'.  Make sure the dependency is published to the repository before publishing this module.

Error details

Exception             :
    Type    : System.ArgumentException
    Message : Dependency 'Hyper-V' was not found in repository 'local'.  Make sure the dependency is published to the repository before publishing this module.
    HResult : -2147024809
CategoryInfo          : ObjectNotFound: (:) [Publish-PSResource], ArgumentException
FullyQualifiedErrorId : DependencyNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.PublishPSResource
InvocationInfo        :
    MyCommand        : Publish-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 297
    Line             : Publish-PSResource -Path .\test.ps1 -Repository local
    PositionMessage  : At line:1 char:1
                       + Publish-PSResource -Path .\test.ps1 -Repository local
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Publish-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

PSResourceGet: 0.5.22
PowerShell: 5.1 and 7.3.5

Visuals

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions