.NET versioning is a mess and very confusing. What is this for? Just reporting?
I think this is really what you are looking for:
unique values of versions of (files "mscorwks.dll" of it; files "clr.dll" of it) of folders of folders whose(name of it starts with "Framework") of folders "Microsoft.NET" of windows folders
Note: on my windows 10 machine, this gives me 4.6.127.1
which isn’t accounted for in your logic.
I would definitely report this raw data in addition to parsing it out like you are doing to try to determine the actual version number info.
Your relevance above uses more IF-THEN-ELSE statements than needed. Many of those could be removed.
Here is one option:
(it as version) of unique values of names of keys whose(name of it as lowercase starts with "v") of keys "HKLM\Software\Microsoft\NET Framework Setup\NDP" of (x64 registries; x32 registries)
Another:
unique values of (it as string as trimmed string as version) of values "version" of (it; keys of it) of keys whose(name of it as lowercase starts with "v" AND not exists values "" whose("deprecated" = it) of it) of keys "HKLM\Software\Microsoft\NET Framework Setup\NDP" of (x64 registries; x32 registries)
Another:
(it as version) of unique values of names whose(exists (it as version)) of keys of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" of (x64 registries; x32 registries)
Another:
(it as version) of unique values of names whose(it starts with "v") of folders of folders whose(name of it starts with "Framework") of folders "Microsoft.NET" of windows folders
Another:
unique values of versions of (files "mscorwks.dll" of it; files "clr.dll" of it) of folders of folders whose(name of it starts with "Framework") of folders "Microsoft.NET" of windows folders
If I combine them all together, I get this:
Q:unique values of (it as string) of ( ( (it as version) of unique values of names of keys whose(name of it as lowercase starts with "v") of keys "HKLM\Software\Microsoft\NET Framework Setup\NDP" of (x64 registries; x32 registries) );( unique values of (it as string as trimmed string as version) of values "version" of (it; keys of it) of keys whose(name of it as lowercase starts with "v" AND not exists values "" whose("deprecated" = it) of it) of keys "HKLM\Software\Microsoft\NET Framework Setup\NDP" of (x64 registries; x32 registries) );( (it as version) of unique values of names whose(exists (it as version)) of keys of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" of (x64 registries; x32 registries) );( (it as version) of unique values of names whose(it starts with "v") of folders of folders whose(name of it starts with "Framework") of folders "Microsoft.NET" of windows folders );( unique values of versions of (files "mscorwks.dll" of it; files "clr.dll" of it) of folders of folders whose(name of it starts with "Framework") of folders "Microsoft.NET" of windows folders ) )
A: 1.0
A: 1.0.3705
A: 1.1.4322
A: 2.0.50727
A: 2.0.50727.4927
A: 2.0.50727.8669
A: 3.0
A: 3.0.30729.4926
A: 3.5
A: 3.5.30729.4926
A: 4
A: 4.0
A: 4.0.30319
A: 4.6.127.1
A: 4.6.79
To get the maximum of all of those values:
Q:maximum of pads of (it as version) of unique values of (it as string) of ( ( (it as version) of unique values of names of keys whose(name of it as lowercase starts with "v") of keys "HKLM\Software\Microsoft\NET Framework Setup\NDP" of (x64 registries; x32 registries) );( unique values of (it as string as trimmed string as version) of values "version" of (it; keys of it) of keys whose(name of it as lowercase starts with "v" AND not exists values "" whose("deprecated" = it) of it) of keys "HKLM\Software\Microsoft\NET Framework Setup\NDP" of (x64 registries; x32 registries) );( (it as version) of unique values of names whose(exists (it as version)) of keys of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" of (x64 registries; x32 registries) );( (it as version) of unique values of names whose(it starts with "v") of folders of folders whose(name of it starts with "Framework") of folders "Microsoft.NET" of windows folders );( unique values of versions of (files "mscorwks.dll" of it; files "clr.dll" of it) of folders of folders whose(name of it starts with "Framework") of folders "Microsoft.NET" of windows folders ) )
A: 4.6.127.1