Skip to content

Module conflict in PowerShell during installation #11

@ahpooch

Description

@ahpooch

Convert module Installation problem

While installing Convert module, I encountered a well known issue of commandlet name overlap with -AllowClobber. Initially, I needed the pwshEmojiExplorer module, which depends on the Convert module. The problem occurs in both PowerShell 5.1 and PowerShell 7, although the underlying reasons differ somewhat. Below, I will describe what these issues look like when installing the Convert module.

PSVersion: 7.5.4 (Core)

When trying to install module in Powershell 5.1 I got this error:

Install-Package: The following commands are already available on this system:'ConvertFrom-CliXml,ConvertTo-CliXml'. This module 'Convert' may override the existing commands. If you still want to install this module 'Convert', use -AllowClobber parameter.

The problem is cmdlets 'ConvertTo-CliXml' and 'ConvertFrom-CliXml' from Convert module. The same cmdlets or maybe just named equally already present at Microsoft.Powershell.Utility built-in system module but in binary form.

PSVersion: 5.1.26100.7019

When trying to install module in Powershell 5.1 I got this error:

PackageManagement\Install-Package : The following commands are already available on this system: "Get-Hash". This module "Convert" may override the existing commands. If you still want to install this module 'Convert', use -AllowClobber parameter.
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 знак:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

The problem is in Get-Hash Alias from Convert module.

Question

Given the above, I'd like to ask, @austoonz, what do you think: is it a good idea to remove the cmdlets 'ConvertTo-CliXml' and 'ConvertFrom-CliXml', as well as the alias 'Get-Hash' from the project? Or would a better solution be to rename the cmdlets so they don't conflict with the system cmdlets, for example, changing them to 'ConvertTo-CliXml2' and 'ConvertFrom-CliXml2'? Or perhaps you see another, better solution to this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions