【发布时间】:2017-10-27 05:35:36
【问题描述】:
我在为 Windows 构建新的 cordova 项目时遇到问题。
我安装了以下版本:
- cordova@7.0.0,不过也可以用cordova@6.5复现
- Visual Studio 2017 Enterprise,包含适用于 Apache Cordova、Windows Mobile 模拟器等的工具。
- 已安装 MS Build Tools v14 和 v15。
所以,要重现:
cordova create project1cd project1cordova platform add windowscordova build windows
然后出现如下错误:error MSB4019: The imported project "C:\Program Files (86)\MSBuild\Microsoft\VisualStudio\v14.0\JavaScript\Micros oft.VisualStudio.WJProject.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk
当我将 --verbose 标志添加到构建时,我注意到 C:\WINDOWS\system32\reg.exe query,HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.0,/v,MSBuildToolsPath 命令没有返回成功,因此它使用构建工具 v14 而不是 v15。
如果我使用 Visual Studio 2017 创建一个新项目,它会在 Visual Studio 中成功编译和运行,但在 cordova build windows 命令上出现相同的错误。
我想这是安装了正确的注册表项,它会正常工作。我应该如何正确添加它们?或者 Visual Studio 正在做什么而不是使用 cordova 或 taco 命令完成?
【问题讨论】:
标签: cordova msbuild visual-studio-cordova