If you install the 64-bit version of Visual Studio to a custom location, the .NET Framework may be installed at a location other than that to which the FrameworkSDKDir environment variable points. This prevents the compiler from finding the .NET SDK. Typically in this situation, the .NET framework will have been installed to the C:\Program Files\Microsoft .NET\SDK directory, while the FrameworkSDKDir variable points to a directory under the compiler location.
You can fix this problem in either of the following two ways: