Search code examples
.netvisual-studio-2010windows-10

Cannot install Windows SDK 7.1 on Windows 10


I'm a software developer with a Windows 10 PC. I have to support some older software written in Visual Studio 2010 using Windows SDK 7.1

In trying to set up the development environment, I have successfully installed VS2010, and come to install Windows SDK 7.1, however the installer gives the error:

Some components cannot be installed

Some Windows SDK components require the RTM .NET Framework 4. Setup detected a pre-release version of the .NET Framework 4. If you continue with Setup, these components will not be installed. If you want to install these components, click Cancel, then install the .NET Framework 4 from http://go.microsoft.com/fwlink/?LinkID=187668 and then rerun Setup.

However, Windows 10 comes with .NET 4.5, so as far as I can tell there is yet another version check problem.

This would not worry me so much, but in attempting to install the Visual Studio 2010 compiler update, this fails, saying

cannot install because windows sdk 7.1 is not found

Attempting to install .NET 4 fails because it detects a later version of .NET.


Solution

  • @dougg3's answer scripted:

    First install SubInAcl,can be downloaded from Microsoft here. You may need to add it to your PATH, ex: set PATH=%PATH%;C:\Program Files (x86)\Windows Resource Kits\Tools

    Then run these commands in an elevated cmd prompt:

    for /f "tokens=2*" %%a in ('reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client" /v Version /reg:32') do set "CurrentNDPv4ClientVersion=%%~b"
    for /f "tokens=2*" %%a in ('reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" /v Version /reg:32') do set "CurrentNDPv4FullVersion=%%~b"
    subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" /setowner="%username%"
    subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" /grant="%username%"=f
    reg ADD "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" /v Version /t REG_SZ /d 4.0.30319 /reg:32 /f
    reg ADD "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client" /v Version /t REG_SZ /d 4.0.30319 /reg:32 /f
    
    echo start your installer now
    pause
    
    reg ADD "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client" /v Version /t REG_SZ /d %CurrentNDPv4ClientVersion% /reg:32 /f
    reg ADD "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" /v Version /t REG_SZ /d %CurrentNDPv4FullVersion% /reg:32 /f
    
    subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" /revoke="%username%"
    subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" /setowner="NT SERVICE\TrustedInstaller"