Reputation: 1277
I have a requirement in my software, in which I need to know whether the client's system have .Net Framework 4.6 installed or not.
What I have tried is -
var frameworkVersion = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full", false)?.GetValue("Version");
The above is giving me the highest version installed, that is - 4.7. From which I can't decide whether the client system have framework 4.6 installed specifically.
Upvotes: 4
Views: 4103
Reputation: 2099
This link should give you what you need. Dot net installed versions explanation
To search for a specific version check the number as an equals. They should be backwards compatible, though, so Microsoft recommends checking with greater than the earliest version number you're compatible with.
If you're not forwards compatible..... You might want to fix that.
Upvotes: 2