.net 无法在 Windows 10 上安装 Windows SDK 7.1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32091593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 09:43:01  来源:igfitidea点击:

Cannot install Windows SDK 7.1 on Windows 10

.netvisual-studio-2010windows-10

提问by Greg

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

我是一名拥有 Windows 10 PC 的软件开发人员。我必须支持一些使用 Windows SDK 7.1 在 Visual Studio 2010 中编写的旧软件

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:

在尝试搭建开发环境时,我已经成功安装了VS2010,来安装Windows SDK 7.1,但是安装程序报错:

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=187668and then rerun Setup.

某些组件无法安装

某些 Windows SDK 组件需要 RTM .NET Framework 4。安装程序检测到 .NET Framework 4 的预发布版本。如果继续安装程序,将不会安装这些组件。如果要安装这些组件,请单击取消,然后从http://go.microsoft.com/fwlink/?LinkID=187668安装 .NET Framework 4 ,然后重新运行安装程序。

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

但是,Windows 10 带有 .NET 4.5,据我所知还有另一个版本检查问题。

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

这不会让我太担心,但是在尝试安装 Visual Studio 2010 编译器更新时,这失败了,说

cannot install because windows sdk 7.1 is not found

无法安装,因为找不到 windows sdk 7.1

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

尝试安装 .NET 4 失败,因为它检测到更高版本的 .NET。

采纳答案by janv8000

@dougg3's answer scripted:

@dougg3 的回答脚本:

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

首先安装SubInAcl,可以从微软这里下载。您可能需要将其添加到 PATH 中,例如:set PATH=%PATH%;C:\Program Files (x86)\Windows Resource Kits\Tools

Then run these commands in an elevated cmd prompt:

然后在提升的 cmd 提示符下运行这些命令:

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"

回答by Jeremy Wong

I stumbled across another workaround, which I've also posted on a msdn thread:

我偶然发现了另一种解决方法,我也在msdn 线程上发布了它:

  1. Uninstall any Visual C++ 2010 Redistributables from the control panel first.

  2. Download the corresponding offline ISO imagefrom the Windows SDK archive. Thislists which ISO is which.

  3. After mounting the image, open F:\Setup\SDKSetup.exe directly.

  1. 首先从控制面板卸载任何 Visual C++ 2010 Redistributables。

  2. 从 Windows SDK 存档下载相应的脱机 ISO 映像列出了哪个 ISO 是哪个。

  3. 挂载镜像后,直接打开F:\Setup\SDKSetup.exe。

回答by dougg3

I just ran into this same problem. No idea how safe this actually is to do, but I was able to work around it by temporarily fooling the installer into thinking I had a different version of .NET 4.0 installed. I opened Process Monitorand used it to monitor everything that setup.exe was doing in order to find out how it was determining that I had a "pre-release" version of .NET 4.0.

我刚刚遇到了同样的问题。不知道这实际上有多安全,但我能够通过暂时欺骗安装程序使我认为我安装了不同版本的 .NET 4.0 来解决它。我打开了Process Monitor并用它来监控 setup.exe 所做的一切,以了解它是如何确定我拥有 .NET 4.0 的“预发布”版本的。

It turns out that it looks at these two strings in the registry:

事实证明,它查看注册表中的这两个字符串:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client\Version
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full\Version
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client\Version
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full\Version

On my Windows 10 machine, these currently are both 4.6.00079. The installer doesn't seem to like this value. I temporarily replaced both of them with the string 4.0.30319in regedit to match the value from InstallPath, and that seemed to do the trick. And of course, when I was finished, I put them back the way they originally were.

在我的 Windows 10 机器上,这些目前都是4.6.00079. 安装程序似乎不喜欢这个值。我暂时用4.0.30319regedit 中的字符串替换了它们以匹配 InstallPath 中的值,这似乎可以解决问题。当然,当我完成后,我把它们放回原来的样子。

However, I did not have permission to change those values, so it was a bit tricky. I right-clicked on the Clientkey, chose Permissions, and clicked Advanced. Then I changed the owner to my user account instead of TrustedInstaller. This allowed me to add permissions for Full Control for myself so I could modify the Versionvalue. I repeated the same process on the Fullkey. After the installer completed successfully, I put the original version values back in (4.6.00079), deleted the permissions I added for myself, and restored the owner to TrustedInstaller (to do that, type NT SERVICE\TrustedInstalleras the username).

但是,我没有更改这些值的权限,所以有点棘手。我右键单击该Client键,选择权限,然后单击高级。然后我将所有者更改为我的用户帐户而不是 TrustedInstaller。这允许我为自己添加完全控制的权限,以便我可以修改该Version值。我在Full钥匙上重复了同样的过程。安装程序成功完成后,我将原始版本值放回 ( 4.6.00079),删除我为自己添加的权限,并将所有者恢复为 TrustedInstaller(为此,请键入NT SERVICE\TrustedInstaller用户名)。

There might be a safer/easier way of intercepting the registry reads than actually modifying the registry, but this was simple enough for me!

拦截注册表读取的方法可能比实际修改注册表更安全/更简单,但这对我来说已经足够简单了!

回答by CAM_344

Great answer by Dougg3 above. Just so it helps others, I went through the process and took some screen shots in case it helps anybody. I do have 64 bit Windows 10.

上面 Dougg3 的精彩回答。为了帮助其他人,我完成了整个过程并拍摄了一些屏幕截图,以防它对任何人有所帮助。我有 64 位 Windows 10。

This is the reg edit file path that Dougg referenced. ThsHere click on Advanced button

这是 Dougg 引用的 reg 编辑文件路径。 这这里点击高级按钮

enter image description here

在此处输入图片说明

Where it says Owner on the top click the Change link enter image description here

在顶部显示所有者的地方单击更改链接 在此处输入图片说明

The next image has two steps - first click on Advanced from "Select User or Group" then click on Find Now button on next dialogue which has the same title. enter image description here

下一个图像有两个步骤 - 首先从“选择用户或组”中单击“高级”,然后单击下一个具有相同标题的对话框中的“立即查找”按钮。 在此处输入图片说明

Find the user you want to change owner to then click ok enter image description here

找到您要更改所有者的用户,然后单击确定 在此处输入图片说明

Click ok on the next page

在下一页点击确定

enter image description here

在此处输入图片说明

Go to your user you just selected on previous dialogues then select Allow Full Control, then click OK enter image description here

转到您刚刚在之前的对话框中选择的用户,然后选择“允许完全控制”,然后单击“确定” 在此处输入图片说明

Now you're able to edit the version. enter image description here

现在您可以编辑版本。 在此处输入图片说明

After you're finished with this revert the version number to what it was before and undo giving yourself the Full Control for that registry.

完成此操作后,将版本号恢复为之前的版本号并撤消为自己提供对该注册表的完全控制权。

回答by Dealazer

Install SDK 7.1 on your computer, it will mostly fail on compiler extras, but you need this first.

在您的计算机上安装 SDK 7.1,它通常会在编译器附加功能上失败,但您首先需要它。

Now install this compiler package from Microsoft:

现在从 Microsoft 安装这个编译器包:

http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4422

http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4422

It will then install the compiler and make it possible to use the compiler.

然后它会安装编译器并使使用编译器成为可能。

回答by Andrew Allen

If your here trying to install psycopg2make sure your pip is up-to-date or you'll get these errors.

如果您在这里尝试安装,请psycopg2确保您的 pip 是最新的,否则您会收到这些错误。

pip install -U pip

pip install -U pip

pip install psycopg2-binary

pip install psycopg2-binary

See - http://initd.org/psycopg/docs/install.html

见 - http://initd.org/psycopg/docs/install.html

回答by smilesAtYourDog

download the exe. change the extension from 'exe' to 'zip'. extract the file now. run SDKSetup.exe from within the /Setup directory

下载exe。将扩展名从“exe”更改为“zip”。现在提取文件。从 /Setup 目录中运行 SDKSetup.exe

回答by tkrn

I just needed to compile some one else's code quickly and this was the fix for me on Windows 10.

我只需要快速编译其他人的代码,这就是我在 Windows 10 上的解决方案。

https://www.microsoft.com/en-us/download/details.aspx?id=4422

https://www.microsoft.com/en-us/download/details.aspx?id=4422