2

Inno setup check dotnet core is installed. Couldn't find REG_DWORD for .net core in Registry Editor. Could someone help me in locating the .net core version in Registry Editor to check if .net core is installed

Learner
  • 167
  • 7

1 Answers1

1

Currently running dotnet --version or dotnet --info is probably the simplest way. I guess, since .net core can be installed anywhere (Mac, Linux, Windows) they decided to stick with CLI.

I've seen people using HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\... to check a version but I believe this is not a consistent solution across .net core versions, OS versions, 32bit and 64bit, etc, so try to avoid using Registry

You can also programmatically look up the dotnet folder in Program Files. If it's there, go to the host/fxr sub directory and find the latest version there i.e.

C:\Program Files\dotnet\host\fxr\*VERSION*\hostfxr.dll

Btw, hostfxr.dll library exposes an export hostfxr_get_available_sdks. You can load the library and call this API (no setup necessary) to get the list of installed SDKs - this is similar to dotnet --info.

Also, check out this question - you can find more ways of check .net core version.

I hope it helps

Pavel Kovalev
  • 7,521
  • 5
  • 45
  • 67
  • 1
    Ok, this shows how *you* can check if the runtime is installed, but now how *InnoSetup* can check if the runtime is installed. Can you provide a code example showing how to, for instance, use `dotnet --info`? That's the part I'm struggling with, not the command itself. It's integrating that command and its output into my script/setup. – Mark A. Donohoe May 14 '21 at 03:28