MATLAB: Does Microsoft Windows SDK 7.1 not get detected as a supported compiler for Windows 10 with Framework 4.6

-setupMATLAB Compilermexnet

I have installed the supported Microsoft Windows SDK 7.1 compiler on my Windows 10 machine. The machine also has .NET Framework 4.6 installed, but MEX still cannot find a C compiler. I get this error message when typing 'mex -setup':
ERROR: >> mex -setup
Warning: Windows SDK 7.1 appears to be installed, but its compiler was not found. Install .NET Framework 4.0, and then rerun the SDK installation to add the "Visual C++ Compilers" component. See
https://www.mathworks.com/matlabcentral/answers/100144-why-does-mex-not-find-the-microsoft-windows-sdk-7-1-installed-on-64-bit-windows-in-matlab-7-14-r201
for more information.
Error using mex
No supported compiler or SDK was found. You can install the freely available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler. For more options, see
https://www.mathworks.com/support/requirements/previous-releases.html

Best Answer

This happens because Microsoft Windows SDK 7.1 automatically starts installing .NET Framework 4.0. .NET Framework 4.6 is included with Windows 10, and there's no way to turn it off. The .NET 4.0 installer won't install in Windows 10 because a newer version is already installed, and the installation of SDK silently fails. 
To fix this, download and install the Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1 in order to fix this issue:
Related Question