VS2017 + ICC 19.0:运行 MSBuild 命令失败
VS2017 + ICC 19.0: Failed to run MSBuild command
我正在尝试在 ICC 19.0 编译器之上使用 Visual Studio 2017 构建一个 C++ 项目。
这是我尝试执行的命令:
cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 19.0" ..
这是我经常遇到的错误:
CMake Error at CMakeLists.txt:17 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2019-12-24 15:19:24.
Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio17\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj" (default target) (1) ->
C:\Program Files (x86)\Microsoft Visual Studio17\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.08
Exit code: 1
-- Configuring incomplete, errors occurred!
我确实安装了 VS2017 构建工具 — 并为此重新安装了几次。
我做错了什么?
为什么它要尝试使用我什至没有的 VS2015 构建工具?
[UPD:] 即使我从 x64 Native Tools Command Prompt for VS2017
.
执行此命令,结果也是一样的
请检查文件 "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" 是否存在。
如果项目是从VS2015移植的,请检查项目文件(.csproj/.vbproj)中的VisualStudioVersion参数,例如"C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj".
好吧,在很懊恼之后我发现发生了什么事。
ICC 19.0 安装程序错误识别了 Visual Studio 的版本并安装了 MSVS 2015 扩展而不是 2017,这导致 CMake 认为它应该使用根本不存在的 MSVS 2015 构建工具。
问题已解决。
解决这个问题所要做的就是从 ICC 安装程序菜单中选择“修改”并切换到正确的扩展集。
我正在尝试在 ICC 19.0 编译器之上使用 Visual Studio 2017 构建一个 C++ 项目。
这是我尝试执行的命令:
cmake -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 19.0" ..
这是我经常遇到的错误:
CMake Error at CMakeLists.txt:17 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 2019-12-24 15:19:24.
Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio17\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj]
Done Building Project "C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj" (default target) (1) ->
C:\Program Files (x86)\Microsoft Visual Studio17\Professional\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Redirect.14.props(47,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. [C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.08
Exit code: 1
-- Configuring incomplete, errors occurred!
我确实安装了 VS2017 构建工具 — 并为此重新安装了几次。
我做错了什么?
为什么它要尝试使用我什至没有的 VS2015 构建工具?
[UPD:] 即使我从 x64 Native Tools Command Prompt for VS2017
.
请检查文件 "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props" 是否存在。
如果项目是从VS2015移植的,请检查项目文件(.csproj/.vbproj)中的VisualStudioVersion参数,例如"C:\Users\user001\Desktop\myproject\build\CMakeFiles.16.2\VCTargetsPath.vcxproj".
好吧,在很懊恼之后我发现发生了什么事。
ICC 19.0 安装程序错误识别了 Visual Studio 的版本并安装了 MSVS 2015 扩展而不是 2017,这导致 CMake 认为它应该使用根本不存在的 MSVS 2015 构建工具。
问题已解决。 解决这个问题所要做的就是从 ICC 安装程序菜单中选择“修改”并切换到正确的扩展集。