Pscx: PSCX conflicts with multiple commands in version 5.1

PSCX conflicts with multiple commands in version 5.1 build 15063 revision 138

install-package PSCX

The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
install-package : The following commands are already available on this system:'gcb,Expand-Archive,Format-Hex,Get-Hash,help,Invoke-NullCoalescing,prompt,Get-Clipboard,Get-Help,Set-Clipboard'. This
module 'Pscx' may override the existing commands. If you still want to install this module 'Pscx', use -AllowClobber parameter.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 29
  • Comments: 31 (7 by maintainers)

Commits related to this issue

Most upvoted comments

PSCX is compatible with PS v3 through v5.1. The above is just a warning. Keep in mind that PSCX had all of these commands years before they were added to PowerShell.

Since our commands sometimes have different parameters (or behave differently) removing them is tricky because we can break folks who have written scripts to use the PSCX versions of these commands.

Anyway the workaround is to module name qualify the command you want to run e.g.:

Microsoft.PowerShell.Compression\Expand-Archive

Or you could use a module prefix when importing the module e.g.

Import-Module Pscx -Prefix Pscx
Expand-PscxArchive

@davidski The current plan is to let PSCX 3.2.x ride as-is. Well, I have at least one more update for 3.2.x I need to get out. After that, we want to subdivide PSCX into smaller modules and make as many as possible run cross-platform. Just been waiting on the .NET Standard / Core 2.0 tooling in VS 2017, as well as the PS Core ref assemblies, to get to a decent state. I spent a lot of time on the ASP.NET Core alpha wave porting a web site and got burned by having to fix stuff after just about every new drop. And then .NET Core 2.0 was announced and a good chunk of that stuff I was changing to work with 1.x didn’t need to be changed anymore. Decided that I wasn’t going to spend any more time on .NET Core until 2.0 and good tooling were released.

Maybe the best solution is to use the PSCX prefix by default to avoid clashes with current and feature Powershell releases. For compatibility reasons, a version without the PSCX prefix may be also released.

@macmodrov Pay attention to difference between Install-Module and Import-Module.

As suggested by @u0m3 in issue #14 a quick fix can be to import the module with a prefix. That require the module being saved locally first: `Save-Module -Name ‘Pscx’ -LiteralPath 'C:\temp' -Repository PSGallery -RequiredVersion 3.3.1 -Force Import-Module -Name ‘C:\temp\Pscx’ -Prefix Pscx -Scope Global -PassThru

Get-Module -Name ‘Pscx’ Get-Command -Module ‘Pscx’ Remove-Item -LiteralPath ‘C:\temp\Pscx’ -Force` Unfortunately it looks like the administrator context is lost before the call of Remove-Item. A new PowerShell session as administrator can remove the folder with its files.

No it doesn’t drop support for 1.x. The thing that .NET 4.7.1 does provide is the ability handle type forwarding for netstandard2.0 libraries to .NET 4.7.1 without requiring recompilation of .NET exe (or tweaks to the app.config to add binding redirects and add probing paths).

v4 will address most if not all of these. There is a beta1 I published that addresses most except for help, Get-Help and prompt. I think I’ll remove the prompt functionality (there are way better pkgs now like oh-my-posh).

I ended up using each of the functions I needed by simply prefixing them with Pscx\<function

e.g.

Pscx\Read-Archive -Path $Path -IncludeDirectories

The archive expanding facilities in this library are a lifesaver, thank you!!! 😄 Fotis

The error message should indicate that you can use -AllowClobber to allow the installation to continue.

Can you use -prefix with Install-Module cmdlet? I know its for Import-Module but want to use the nuget repository to install as this will be an on Start-Up script for setting up new servers. So for example below wont work but, is there any other method?

Install-Module Pscx -Scope CurrentUser -Prefix Pscx -Force