Skip to content

Publish-PSResource is case sensitive when checking required external modules #1557

@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

When publishing script with required module that is also added to EXTERNALMODULEDEPENDENCIES metadata field, the check is case sensitive and doesn't recognize module as same, when module name case differs from each other.

Example script to demonstrate problem: publishexternal.ps1

Expected behavior

PS > Publish-PSResource -Path .\publishexternal.ps1 -Repository test

# script is published

Actual behavior

PS > Publish-PSResource -Path .\publishexternal.ps1 -Repository test -Verbose

VERBOSE: Performing the operation "Publish-PSResource" on target "Publish resource 'C:\Projects\GitHub\Examples\src\quirks\PSResourceGet\publishexternal.ps1' from the machine".
VERBOSE: The newly created nuspec is: C:\Users\user\AppData\Local\Temp\23755338-4f6d-4148-99f8-00ee095e7b87\publishexternal.nuspec
Publish-PSResource: Dependency 'SqlServer' 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\user\AppData\Local\Temp\23755338-4f6d-4148-99f8-00ee095e7b87'

Error details

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

Environment data

Versions
--------
PSResourceGet: 1.0.1
PowerShell: 7.4.1 and 5.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    TODO

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions