PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
490 stars 94 forks source link

Publish-PSResource fails with ModuleSpecification and prerelease module #1305

Closed ThomasNieto closed 1 year ago

ThomasNieto commented 1 year ago

Prerequisites

Steps to reproduce

Trying to publish https://github.com/anypackage/psresourceget to a local repository that already PSResourceGet there.

RequiredModules = @(
        @{ ModuleName = 'AnyPackage'; ModuleVersion = '0.5.1' },
        'Microsoft.PowerShell.PSResourceGet')

Expected behavior

# publish successfully

Actual behavior

Publish-PSResource -Repository test -Path ~\Documents\PowerShell\Modules\AnyPackage.PSResourceGet -Verbose
VERBOSE: Performing the operation "Publish-PSResource" on target "Publish resource 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.PSResourceGet' from the machine".
VERBOSE: Creating new nuspec file.
VERBOSE: The newly created nuspec is: C:\Users\Thomas\AppData\Local\Temp\6a50c3a5-07fd-4859-98d3-cb33d1503c18\AnyPackage.PSResourceGet.nuspec
VERBOSE: Searching in repository test
VERBOSE: Searching in repository test
Publish-PSResource: Dependency 'System.Collections.Hashtable' was not found in repository 'test'.  Make sure the dependency is published to the repository before publishing this module.
VERBOSE: Deleting temporary directory 'C:\Users\Thomas\AppData\Local\Temp\6a50c3a5-07fd-4859-98d3-cb33d1503c18'

Error details

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

Environment data

beta23

Visuals

No response

ThomasNieto commented 1 year ago

@anamnavi After some more investigation publishing fails when a required module is used with ModuleSpecification and the other is a prerelease module.