Here's an example on how to use the values in the registry to check for dotNET 4.5 or higher. I'd recommend putting this snippet of code somewhere like .OnInit as this will execute before anything else happens; this way it checks for .NET before any files get copied or registry changes take place.
...
Function dotNETCheck
Alternatively you can use the function I wrote below. This one makes use of LogicLib.nsh. It should work out-of-the-box without having to know the .NET versions value from the Release key in the registry. As it is written right now it only checks for versions between 4.5–4.7.
...