Determine highest .NET Framework version

.net, c, c++, version-detection

Solution

Use the Windows Registry location `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP`.

Problem

I need to determine the highest .NET framework version installed on a desktop machine from C\C++ code. Looks like I can iterate the folders under `%systemroot%\Microsoft.NET\Framework`, but that seems kind of error prone. Is there a better way? Perhaps a registry key I can inspect? Thanks.

Original source

Related problems