3

The following answer suggests a directory search to detect an installed Net Core 3.1.x windows desktop runtime: How to detect net core 3.1 windows desktop app runtime is installed

For example, the following code detects version 3.1.4 of the 32-bit Net Core desktop runtime:

    <!-- check for 32-bit runtime -->
    <util:DirectorySearch
          Id="NetCoreDesktopSearch"
          Variable="NetCoreDesktopInstalled"
          Path="[ProgramFilesFolder]dotnet\shared\Microsoft.WindowsDesktop.App\3.1.4"
          Result="exists"
    />

This worked for a while, but with recent updates (presumably with Windows updating to a later runtime version, i.e. version 3.1.14) there seem to be machines where the "3.1.4" folder has disappeared while the actual desktop runtime version 3.1.4 remains installed (i.e. as displayed with dotnet --info). As a result, the installer may try to run the .Net Core Desktop 3.1.4 installer again, which in turn fails with error 0x80070666 - Another version of this product is already installed. and the installation is aborted.

DirectorySearch is therefore not a reliable way to detect a specific version.

Is there a better way?

Can the official .Net Core Desktop installer be instructed to silently succeed if a newer version is present on the system?

Is there an officially sanctioned way to detect a particular .Net Core Desktop version in an installer (i.e. registry search)?

J.R.
  • 1,880
  • 8
  • 16
  • [here is my answer](https://stackoverflow.com/questions/58930065/check-if-netcore-is-installed-using-customaction-with-wix/62679569#62679569) how to check it reliable. it's great option if you can add custom actions (from your code it's hard to get is it msi or bootstrapper) – ba-a-aton Apr 20 '21 at 08:24
  • @ba-a-aton Thank you; I have a MSI and a bundle installer and both need to detect the desktop runtime. I know that I could let the user run into the default .NET prompt to install dependencies but I prefer not to. – J.R. Apr 26 '21 at 00:39
  • and that two installers are wrapped by botstrapper? bad. it's easy to do for msi, but for bundle... only in case you'll find merge modules (I wasn't successfull in search, for example). Custom bootstrapper can help you in this case. It's really hard way, but as bonus you can use your own WPF UI. – ba-a-aton Apr 26 '21 at 10:00
  • also another tricky way is ceate your own installer of bundle) you can get code of wix project from .net repo and add it to your installer. But it's really strange and hard) – ba-a-aton Apr 26 '21 at 10:06
  • The MSI and bundle installers are two different installers for two different purposes. I'd just like to have an 'official' .Net desktop detection method that works for both types. – J.R. Apr 26 '21 at 20:06

0 Answers0