PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Publish-PSResource is case sensitive when checking required external modules

Open peetrike opened this issue 1 year ago • 3 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] 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

peetrike avatar Feb 09 '24 15:02 peetrike

When I change referred module name casing to same, the problem ceases to exist

peetrike avatar Feb 09 '24 15:02 peetrike

Thanks @peetrike what type of repo is test? are you seeing this with multiple repo types? thanks!

SydneyhSmith avatar Feb 12 '24 19:02 SydneyhSmith

Local folder based repository on Windows

peetrike avatar Feb 12 '24 22:02 peetrike