Skip to content

dependency override is not handled correctly when DependencyType is set to PSGalleryModule in PSDependOptions #131

@WiredSharp

Description

@WiredSharp

Considering the following dependencies:

$dependencies = @{
    PSDependOptions = @{
        Target = '.\Tmp'
        AddToPath = $True
        DependencyType = 'PSGalleryModule'
        Parameters = @{
            Repository = 'LOPublic'
        }
    }

    PsDepend = @{
        Version = 'latest'
        Parameters = @{}
    }
}

If you call Get-Dependency -InputObject $dependencies

Parsed dependency is:

(...)
Name            : PsDepend
Version         : {Version, Parameters}
PSDependOptions : {AddToPath, DependencyType, Parameters, Target}
Raw             :

As you can see, the whole hashtable is used as version field value. Indeed the Parse-Dependency function in Get-Dependency.ps1 considers that when DependencyType is set to 'PSGalleryModule' in PSDependOptions, the dependency value is a string.
A solution is to always take into account the type of the $Dependencyhash variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions