winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Unable to install PowerShell Preview 7.4 with PowerShell 7.3 installed.

Open dembeck opened this issue 2 years ago • 4 comments

Brief description of your issue

When attempting to install PowerShell Preview 7.4 side-by-side with PowerShell 7.3 using winget, the installation is blocked with the message "Found an existing package already installed."

It appears that winget is identifying the installed version of PowerShell 7.3 as PowerShell Preview 7.4.

Steps to reproduce

  1. Search for available packages winget search "Microsoft.PowerShell
  2. Attempt to install PowerShell Preview winget install --source 'winget' --interactive --id 'Microsoft.PowerShell.Preview''

Expected behavior

winget should successfully install PowerShell Preview 7.4 side-by-side with PowerShell 7.3.

Actual behavior

winget is unable to differentiate between the two versions of PowerShell and is therefore preventing the installation of the Microsoft.PowerShell.Preview package.

winget listing installed versions of PowerShell.

  • Notice how it identifies PowerShell 7.3 as both "Microsoft.PowerShell" and "Microsoft.PowerShell.Preview".
> winget list --id "Microsoft.PowerShell"

Name                   Id                   Version Source
-----------------------------------------------------------
PowerShell 7.3.1.0-x64 Microsoft.PowerShell 7.3.1.0 winget



> winget list --id "Microsoft.PowerShell.Preview"
Name                   Id                           Version   Available Source
------------------------------------------------------------------------------
PowerShell 7.3.1.0-x64 Microsoft.PowerShell.Preview < 7.4.1.0 7.4.1.0   winget

winget search results and installation error message.

  • I included two different attempts at installing, as they have slightly different error messages.
> winget search "Microsoft.PowerShell"
Name       Id                           Version Source
-------------------------------------------------------
PowerShell Microsoft.PowerShell         7.3.1.0 winget
PowerShell Microsoft.PowerShell.Preview 7.4.1.0 winget



> winget install --scope 'machine' --architecture 'X64' --source 'winget' --interactive --exact --id 'Microsoft.PowerShell.Preview'
Found an existing package already installed. Trying to upgrade the installed package...
No applicable upgrade found.



> winget install --source 'winget' --interactive --id 'Microsoft.PowerShell.Preview'
Found an existing package already installed. Trying to upgrade the installed package...
A newer version was found, but the install technology is different from the current version installed. Please uninstall the package and install the newer version.

Environment

Windows Package Manager (Preview) v1.5.101-preview
Windows: Windows.Desktop v10.0.22621.1105
Package: Microsoft.DesktopAppInstaller v1.20.101.0

dembeck avatar Jan 27 '23 04:01 dembeck

@dembeck do you know if a version of PowerShell from the Microsoft Store has been installed on the machine?

Can you run winget list --id "Microsoft.PowerShell" --source winget

Then run winget list --id "Microsoft.PowerShell"

You should be able to install both versions side by side. WinGet is trying to avoid breaking anything related to installer type changes. I don't want your environment broken, but if you add "--force" to the end of an "install" command, WinGet will bypass the warnings and just run the installer.

denelon avatar Jan 27 '23 18:01 denelon

I think that on this machine I initially installed PS 7.x with the msi from the PowerShell repo. When there is an update, sometimes I use winget, other times I use the latest msi.

> winget list --id "Microsoft.PowerShell" --source winget
Name                   Id                   Version
---------------------------------------------------
PowerShell 7.3.1.0-x64 Microsoft.PowerShell 7.3.1.0


> winget list --id "Microsoft.PowerShell"
Name                   Id                   Version Source
-----------------------------------------------------------
PowerShell 7.3.1.0-x64 Microsoft.PowerShell 7.3.1.0 winget
> Get-Command -Name "*pwsh*"

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     pwsh.exe                                           7.3.1.0    C:\Program Files\PowerShell\7\pwsh.exe

dembeck avatar Jan 28 '23 00:01 dembeck

@denelon Is there anything else you want me to check or any logs that you want me to collect?

I have held off installing PS preview on this system using the force flag or using the msi in case there was any other information you wanted.

dembeck avatar Jan 31 '23 21:01 dembeck

There were a couple of other PowerShell related issues I was looking into.

The PowerShell from the Microsoft Store is the "MSIX" package. The PowerShell from the community repository is the "MSI" package (excluding the ARM64 variant)

Some changes had been made to the manifest and were subsequently reverted to pull the MSIX versions back out for x86 and x64.

  • https://github.com/microsoft/winget-pkgs/issues/95172
  • https://github.com/microsoft/winget-pkgs/issues/94861

The machine scope is being added back to the manifests now (unfortunately, we're having some issues with the validation pipelines so they are currently stalled)

denelon avatar Jan 31 '23 23:01 denelon

When running winget upgrade --id Microsoft.PowerShell I also get

A newer version was found, but the install technology is different from the current version installed. Please uninstall the package and install the newer version.

We have a WSUS server that installs Powershell causing an issue as it installs using an .exe, whereas I think Winget uses .msi.

How can we get around this?

tb-mtg avatar Nov 02 '23 22:11 tb-mtg