how to detect whether .NET 6.0 desktop runtime 6.0.8 is installed or not

Vatier, Daniel 1 Reputation point
2022-08-29T09:24:30.043+00:00

I would like to install .NET 6.0 Desktop Runtime 6.0.8, that is windowsdesktop-runtime-6.0.8-win-x64.exe*, as a prerequisite through a setup.exe developed from Installshield 2020 since our app requires .NET 6.0 Desktop 6.0.8 and I try to find the installation conditions for .NET 6.0 desktop 6.0.8. In other words, how to detect whether .NET 6.0 desktop runtime 6.0.8 is already installed or not?

Initially I was looking at the entry Version from the registry key HKEY_LOCAL_MACHINE\SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedhost. Unfortunately I noticed the key is not necessarily updated by .NET 6.0 Desktop 6.0.8 installer.

After doing a bit of internet search, I come across https://learn.microsoft.com/en-us/answers/questions/913327/correct-approach-to-check-for-net-6-installation.html which seems to indicate the registry HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.WindowsDesktop, entry name <version>, in my case the registry entry “6.0.8” is probably better as it represents whether version 6.0.8 of .NET 6.0 Desktop is installed or not. From experiments, it seems to me the sharedhost ‘s Version represents the .NET 6.0 runtime version and not the version of the desktop part or whether it is installed or not (before installing 6.0.8, the value of sharedhost ‘s Version was 6.0.6, become 6.0.8 after 6.0.8 is installed and if I uninstall manually Desktop Runtime 6.0.8, the value does not change from 6.0.8, however, HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.WindowsDesktop.App’s key 6.0.8 is removed after .NET 6.0 Desktop 6.0.8 is uninstalled.

Would you agree to say that the entry 6.0.8 in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.WindowsDesktop.App indicates that .NET 6.0 Desktop 6.0.8 is installed and that the entry I should check before trying to install or not .NET 6.0 Desktop 6.0.8?

By the way, I am assuming that other versions of .NET 6.0 desktop can live along 6.0.8 and be installed in any specific order. Maybe I am wrong...

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,117 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. abbodi86 3,776 Reputation points
    2022-08-29T19:06:12.2+00:00

    Yes, i think that registry value is the safest way

    .NET 6.0 Desktop versions are in-place upgrade to each other, the latest version 6.0.8 will replace all previous versions, and any previous version will not install if 6.0.8 is present

    same for .NET 5 and 7

    1 person found this answer helpful.
    0 comments No comments

  2. Jason Adams 1 Reputation point
    2022-09-15T22:42:58.013+00:00

    Hi what did you set as the data type for detection? String, integer or value?

    0 comments No comments