You have to look in the registry for
HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full.
If you have only version 4.0, "Version" is "4.0" and there is no "Release" key.
The official Microsoft documentation says that if the "Release" key exists and it's value is greater than 378389, then it's 4.5.
My observation of looking at exactly two machines: If you already have .Net 4.5 installed, the value of "Version" is 4.5.50709.