HandyOrg / HandyWinGet

GUI for installing apps through WinGet and Creating Yaml file
MIT License
380 stars 33 forks source link

RFF: Ability to verify which version of software is actually installed? #21

Closed JohnLGalt closed 3 years ago

JohnLGalt commented 3 years ago

HWG pulls data from WG repository - I get that. However, a few items I have installed a shown as installed by HWG more than once - perfect example is Discord, which I only have the Public Test Build installed, but HWG is reporting I have both PTB and regular release installed, which have 2 different versions:

09

Is there any way to differentiate?

For example, for Discord PTB, the uninstaller has PTB in name string:

Computer\HKEY_USERS{MY UISER STRING}\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DiscordPTB

I realize that the User string will be variable for every single user across a multitude of Windows installations, but if therre were a way to get the string anyway, it would help preventing duplicate versions being reported as installed.

If it cannot be done, now worries, just close this out - I figured I'd ask, and won't complain if there is not real way to accomplish this.

ghost1372 commented 3 years ago

I find the list of installed programs through the registry And I return their DisplayName, After that, when parsing the packages, I check their names with the DisplayName The method I use is Contains: x.DisplayName.Contains(result.PackageName))

if I use the Equals method Many packages will not be detected Because DisplayName is slightly different from the PackageName.

Contains method checks only part of the name if it contains returns the true value but Equals Method checks exactly that value

The package you mentioned both have the same name (Both start with Discord) Because of Contains method, Both are identified as installed. I have not found a better way to deal with this at the moment However, I am trying to find a better way to solve this problem.

If you have experience in this field or know a better way, I will be happy if you share it with me. I think it is better to keep this issue open

JohnLGalt commented 3 years ago

Interesting.

So I wonder why contains function picks up Discord and Discord PTB, but not Discord Canary now Discord Development.

In searching WinGet, the following get listed:

PowerShell 7.1.3 Copyright (c) Microsoft Corporation.

https://aka.ms/powershell Type 'help' to get help.

PS D:\Users> winget search discord Name Id Version Match

Discord Discord.Discord 1.0.9001 Discord Media Loader Serraniel.DiscordMediaLoader 1.4.0.0 Tag: Discord Rambox Community Edition Rambox.RamboxCE 0.7.5 Tag: discord PlexRichPresence Ombrelin.PlexRichPresence 1.6.0.0 Tag: discord Glass Cannon ChristianAviBulan.GlassCannon 0.1.1 Tag: Discord Discord PTB Discord.DiscordPTB 1.0.1005 Discord Development Discord.DiscordDevelopment 1.0.585 Discord Canary Discord.DiscordCanary 1.0.28 PS D:\Users>

Since you're using x.DisplayName.Contains(result.PackageName)) would it be possible, maybe, to just try x.DisplayName.Contains(PackageName)), or does that fail to find packages?

(I'm assuming that using result.PackageName allows the code to search for Discord.Discord, Discord.DiscordPTB, etc., so that result == 'company name' and PackageName == the actual package....

ghost1372 commented 3 years ago

result.PackageName means PackageName of the current manifest so x.DisplayName.Contains(PackageName)) Does not work. Have you tried the Winget method To identify installed packages? Does this method also report incorrectly?

JohnLGalt commented 3 years ago

That code section in my previous reply (now edited to be a quotation) was directly from Winget in PowerShell.

Discord Discord.Discord 1.0.9001 Discord PTB Discord.DiscordPTB 1.0.1005 Discord Development Discord.DiscordDevelopment 1.0.585 Discord Canary Discord.DiscordCanary 1.0.28

Those are the relevant entries when searching for 'discord' using command winget search discord

I can search for individual package names directly, too.

PS C:\Windows\System32> winget search discordptb yields Discord PTB Discord.DiscordPTB 1.0.1005 Moniker: DiscordPTB

Similarly winget search discordcanary yields Discord Canary Discord.DiscordCanary 1.0.28 Moniker: DiscordCanary

See ss.

10

But, I also realize that you'd have to set up some method to parse the exact package names before performing the Contains function to search for installation, and frankly, parsing like that will take some work - unless you can manage to develop a way so that the names are parsed into a (separate?) database that you only verify if 1) The user presses the refresh button, forcing a full refresh of package manifest database, or 2) new manifests are detected when HWG verifies the manifests.

ghost1372 commented 3 years ago

Ok wait a minute I'm a little confused, Is the problem that programs that are not installed are detected as installed? Or the programs are not searched properly? The answer I gave above is related to the first part. In the case of program searches, the search is based on the package name, but Winget also searches for tags If I want to search for tags as well, I think the program speed will slow down I have just installed Discord and the installation detection is done correctly image

JohnLGalt commented 3 years ago

There are 3 versions of Discord available for download. https://support.discord.com/hc/en-us/articles/360035675191-Discord-Testing-Clients

Technically there is a fourth version, Development, but it is enabled from inside the Canary build itself, as detailed by this discord help page.

I've currently installed all 3 of these builds (just now) to illustrate that each can be installed independently of the others, and simultaneously together, and run separately to each other.

11

15

12 13 14

Now after installing both stable and Canary builds, running side by side, a seen in my screenshots, ll three correctly show as being installed.

However, when I made the report, I only had the PTB installed. I did not have stable or canary installed. But HWG was reporting I had both PTB and stable already installed. It's why the distinction between 'discord' and 'discordPTB' PackageName exists.

I am now uninstalling both Canary and Discord stable.

After uninstalling, I only have DiscordPTB installed:

17

16

But HWG still shows both Discord stable and DiscordPTB installed.

18

ghost1372 commented 3 years ago

i think, Discord is not deleted properly And the registry key remains I attached an application. Download and Run it and click on Export to extract all the registry keys in Export.txt file. Look inside this file to see if there is a Discord registry key or not? (If the program does not run, install .NET Core 3.1 on your system) WpfApp4.zip

JohnLGalt commented 3 years ago

No offense, but I can guarantee this is not the case.

I cleanly installed Windows 10 on 1 Mar 2021. I only installed DiscordPTB and nothing more - but both have always reported as being installed.

I only installed the other 2 versions, stable and canary, today, to show they are not only separate builds, but can be separately and concurrently installed and concurrently run on the same system.

I can easily replicate the results in a VM - installing only DiscordPTB results in both Discord stable and DiscordPTB being reported as installed in HWG.

This is not an issue of detecting an installation that was previously there. This was occurring and continues to occur with only DiscordPTB installed.

I downloaded your app and try to run after extracting, but it asks to install .NET Core 3.1 - which is already installed, as verified by installer. I performed Repair, and app still asks to have it installed. I then uninstalled it and re-installed using installer, and it still says it needs it installed - but it is already installed. I also have verified that I do not have .NET Core 6 preview 2 installed, but I do have .NET Core 5.0.4 installed. Will uninstall 5.0.4 and 3.1 and then install only 3.1 and see if app runs.

I also use a utility called RegEditorX, which includes the same developer's application RegCrawler, which makes for fast searching for terms in reg. I can show that DiscordPTB is what is showing in my system through that, if it helps, since this app seems to think .NET is not installed when in fact it is....

JohnLGalt commented 3 years ago

I installed .NET Core 3.1 x64. App needs x86. Installed.

Here is list.

Export.txt

Only appears once, strictly says DiscordPTB, and has correct version for DiscordPTB as well.

ghost1372 commented 3 years ago

Thank you @JohnLGalt Today I had the opportunity to investigate the problem. I think I found the cause of the problem. I'm working on it

ghost1372 commented 3 years ago

@JohnLGalt After a bit of effort, I was able to display the correct version installed But this solution caused other programs to be affected and reported incorrectly. some programs, such as Winrar, are registered in a different name in registry (WinRAR 5.91 (64-bit) ) I had written the code like this before: InstalledApp.Where(x => x.DisplayName.Contains(PackageName)); This code reported that 2 versions of the discord was installed.

I changed as follows InstalledApp.Where(x => PackageName.Contains(x.DisplayName)); This code reports correctly that 1 version of the discord was installed. However, this time the installation of some programs (such as winrar) is not reported😫

JohnLGalt commented 3 years ago

I had a feeling it would be problematic.

Your results using internal versus WinGet mirror what I saw as well.

Since the current method seems to break only for Discord, while the tested method breaks for more, I suppose until a better way can be developed that leaving everything as is is fine.

Could it be possible the letter case having something to do with it (I only ask because WinRAR uses RAR (all caps) instead of just rar, and Discord PTB, the version I have installed, is also using all caps for part of the name - so I wonder if it might be a factor. I seriously doubt that is the case, but, stranger things have happened with M$ products before).

Thanks for investigating this.

ghost1372 commented 3 years ago

@JohnLGalt No, I ignore uppercase and lowercase letters (There is no problem in this regard)

ghost1372 commented 3 years ago

In the next version I will remove the internal method, And I will only use the Winget method. Recently I found out that the installation of the program can be checked by its Id, Therefore, the results will be very accurate

image

JohnLGalt commented 3 years ago

Good news - even WinGet method has its issues, but by using the available method it's a lot less programming and maintenance for you. And it puts the onus on Microsoft to fix their WinGet issues themselves, also freeing up your time.

ghost1372 commented 3 years ago

Animation

ghost1372 commented 3 years ago

The first beta version has been released, I think this issue can be closed

JohnLGalt commented 3 years ago

Very nice. Only a couple of issues, I have 7Zip Alpha 22 installed and it reports both regular 7Zip stable and 7Zip Alpha installed.

Also, one other app, OpenHashTab by namaszo (here on GitHub) is installed, and it shows version 3.0.1 installed and version 3.0.1 as available.

All other apps that show available only show when diff version is installed.

ghost1372 commented 3 years ago

Thank you, I will definitely check again Also, please enter the following command in your terminal and check if the packages you mentioned are in the list or not.

winget list

This command displays a list of programs installed on the system, So if the list was like HWG, the problem is from Winget

Available version means that a newer version of this app is available on Winget Untitled

JohnLGalt commented 3 years ago

OpenHashTab is listed for sure - and I see the problem - version is reported a v3.0.1 and available is reported as 3.0.1 - so M$ needs to fix that, they're reporting the version with the letter v and it is throwing off their algorithm for latest version.

`Name Id Version Available Source

OpenHashTab namazso.OpenHashTab v3.0.1 3.0.1 winget`

As for 7zip - it only shows available for 21.01, not 21.02 (which is what I have installed):

`Name Id Version Available Source

7-Zip 7zip.7zip 21.02.00.0 7-Zip Alpha (msi) 7zip.7zip.Alpha.msi 21.01 alpha 21.02.00.0 winget`