Visual Studio 构建错误 "This version of NuGet.exe is not compatible with the version of Windows you're running."

Visual Studio build error "This version of NuGet.exe is not compatible with the version of Windows you're running."

我正在尝试在 visual studio 2013 年构建一个网络 API 项目,我从 git 下载了该项目。

但是,每当我尝试构建它时,都会生成以下错误。谁能建议任何帮助来解决这个问题。

我正在使用 windows 8.1visual studio 2013 版本 4。

错误信息:

错误 1 ​​

This version of F:\WebApi\WebApi.nuget\NuGet.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

错误 2

The command ""F:\WebApi\WebApi.nuget\NuGet.exe" install "F:\WebApi\WebApi\src\Sum.WebApi\packages.config" -source "" -NonInteractive -RequireConsent -solutionDir "F:\WebApi-master\WebApi-master\ "" exited with code 216.

您绝对应该从导致问题的 Git 中删除已提交的 nuget.exe。如果您配置 自动包还原 会更好,这同样涉及删除 nuget.exe 文件:

https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore

根据下面的 MSDN 线程,也可以通过修改 .gitattribute 文件来解决此问题:

https://social.msdn.microsoft.com/Forums/en-US/b79c39b9-75d4-4c09-a774-f76474429c83/nugetexe-is-not-compatible-with-the-version-of-windows-youre-running?forum=TFService

但是,我仍然推荐自动包恢复方法。