'How can I check .Net Framework 4.8 Installed on machine

How can I check .Net Framework 4.8 installed on machine using C# WinForms application.

Now our application running on .net Framework 4.0 but we required to upgrade its to .Net Framework 4.8. So before upgrading .net framework we required to check .net framework 4.8 installed on user machine on not.

Thanks All.



Solution 1:[1]

Since you mentioned in your question that you need this for a WinForms application, the recommended way is to configure the supportedRuntime element in your application's config file with the appropriate SKU, e.g.

<configuration>
   <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
   </startup>
</configuration>

Alternatively, if, for whatever reason, you need to check for the presence of .NET Framework 4.8 after starting your application, you can look at the Release value of the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full

A value of 528040 or higher indicates that .NET Framework 4.8 (or higher) is installed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1