C# application host version detection when no .NET runtime is installed

400 views Asked by At

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!

1

There are 1 answers

0
nimblebit On

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