当我尝试构建任何项目时,我在 Windows 10
上遇到了这个奇怪的错误。如果我在其他操作系统上构建这些项目,它们运行良好。
The specified task executable "cmd.exe" could not be run. The specified executable is not a valid application for this OS platform.
当我尝试检查日志时,我在 .nuget
文件夹内的 Nuget.targets
文件中找到了以下代码,我评论了代码,现在项目构建正常.我不明白为什么会出错。我创建的任何新项目都运行良好...
我在 Windows 8
、Windows Server 2008
和 Visual Studio 2015
上使用 Visual Studio 2013
Windows 10
。
代码:
<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
- 这个错误的原因是什么?
- 是因为操作系统还是因为 Visual Studio?
- 我该如何解决?我认为注释代码不是解决问题的方法...
最佳答案
我遇到了同样的错误,修复损坏的文件解决了我的问题。试试这个:
- 在管理员命令提示符下,运行
sfc/scannow
- 它应该在
%windir%\Logs\CBS\CBS.log
中发出日志文件。确认它已修复 cmd.exe。对我来说,我看到了类似这样的内容Repairing corrupted file [ml:48{24},l:46{23}]"\??\C:\WINDOWS\SysWOW64"\[l:14{7}]"cmd.exe"来自商店
- 如果这没有帮助,您可以尝试
DISM/Online/Cleanup-Image/RestoreHealth
- 查看更多 here
关于visual-studio-2013 - 无法运行指定的任务可执行文件 "cmd.exe"。指定的可执行文件不是此操作系统平台的有效应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32470472/