PowerShell / PowerShell/PSResourceGet

Publish-PSResource is case sensitive when checking required external modules

Open
#1,557 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Publish Issue-Bug
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked publishexternal.ps1 reproduction and run Publish-PSResource with a required module whose casing differs from EXTERNALMODULEDEPENDENCIES. Trace the Publish-PSResource external-module dependency check; done means the differently cased names are recognized as the same module and publication succeeds without DependencyNotFound.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.