question

VatierDaniel-1386 avatar image
0 Votes"
VatierDaniel-1386 asked JasonAdams-2279 answered

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

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://docs.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...

dotnet-runtime
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

abbodi86-0005 avatar image
0 Votes"
abbodi86-0005 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JasonAdams-2279 avatar image
0 Votes"
JasonAdams-2279 answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.