0

I have an application that relies on .NET 6 runtime. If I don't have any .NET runtimes installed on my machine, not only the one my application needs but also without other versions of .net runtime, I could see some messages prompted when execute it.

Does anyone have any insight about how the detection work or who gives the prompted information? Is it done by the OS?

Thanks!

Xin Ding
  • 1
  • 1
  • 1
    Locating the installed version of .NETCore is the job of the apphost, not the OS. A project compiled with default settings generates a .exe file with the same name as the project. Typically a direct copy from, say, C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Host.win-x64\6.0.4\runtimes\win-x64\native\apphost.exe. https://github.com/dotnet/runtime/blob/202f0afbdf4e2ca05fc0868c013cc3a0e6177a30/src/native/corehost/apphost/apphost.windows.cpp#L89 – Hans Passant Jun 22 '22 at 13:40

1 Answers1

0

Windows 10 and 11 comes pre-installed with .NET Framework. A .NET 6 application can be released as a self-contained application that includes the required runtimes to run (if it is not on the machine) as suggested here; https://stackoverflow.com/a/72630528/1165173

https://learn.microsoft.com/en-us/dotnet/core/install/how-to-detect-installed-versions?pivots=os-windows

nimblebit
  • 473
  • 3
  • 11
  • 22