cordova windows 构建错误(未检测到所选目标的有效 MSBuild) - 检查所有 Cordova 要求

标签 cordova msbuild

我正在尝试使用cordova构建Windows x64,但仍然没有成功。我收到此错误,并且在论坛中找不到任何可以帮助我的内容,因为在我的情况下检查了所有 Cordova 要求。

No valid MSBuild was detected for the selected target: AppPackages folder doesn't exist



我在 MSBUILDDIR 环境中尝试了不同的地址,目前没有成功。 Cordova 要求也通过了一切!

Cordova 要求
ENV var MSBUILDDIR is set C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64

Requirements check results for windows:
Windows OS: installed Windows 10
MSBuild Tools: installed 15.9
Visual Studio: installed (user-specified via VSINSTALLDIR)
Windows SDK: installed 10.0
Windows Phone SDK: installed 10.0

我的电脑是 64 位 Windows 10 上的 x64 机器,带有 AMD Ryzen 5 2400G APU
任何想法都非常感谢

顺便说一下,到目前为止,我已经解决了几个问题,我离开这里以防以后对某些人有所帮助:

Error: MSBuild v4.0 is not supported, aborting.

Fix: by setting environment variable VSINSTALLDIR = C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\



即使 Visual Studio 2017 与 Cordova 库一起安装,仍然出现以下错误:

Error: Windows SDK not found. Fix: by installing the SDK separately (https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)

Error: I got some errors pointing to Node.js Fix: Installed all Node.JS libraries in VS and also updated Cordova to the last version, one of those should have fixed it since it was gone after I did those

最佳答案

就个人而言,我更喜欢命令行工具。我遇到了同样的问题,并通过分析这些工具的输出设法解决了它。

MSBuild v4.0 is not supported, aborting.



如果您使用 cordova build windows --verbose ,您会看到更多信息。

然后,您必须指定另一个 MSBuild 目标。 Cordova 在注册表中查找这些目标,但 Visual Studio(至少 2017 年)根本不涉及注册表。

所以,我添加了 key MSBuildToolsPathHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\15.5\ (新创建的)指向 C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\15.0\Bin .

这样做后,您不需要指定环境变量 MSBUILDDIRVSINSTALLDIR .但我也手动全局安装了这些工具(例如 npm install -g cordova ),因此使用 VS 提供的工具可能需要使用这些 env 变量。

就我而言,构建之后运行良好。但是请注意,我安装了 VS Community 2017 VS BuildTools .我用这篇文章作为"template":Cordova build windows on Windows 10 and VisualStudio 2017

关于cordova windows 构建错误(未检测到所选目标的有效 MSBuild) - 检查所有 Cordova 要求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53450637/

相关文章:

c# - 构建测试 : check if file exists in another project

.net - Jenkins 构建错误 - MSBUILD : error MSB1009: Project file does not exist

c++ - 使用 MSBuild 将/MP 选项传递给编译器

asp.net-core - .NET Core - 覆盖默认构建目标

javascript - 如何在cordova 相机成功回调时获取文件对象?

android - Cordova Android 在运行时以编程方式设置 windowBackground

javascript - 上传前在 Phonegap 中压缩视频文件

ios - XCode 9 中的 “2 duplicate symbols for architecture x86_64”

android - Appcelerator Titanium 或 PhoneGap 上的 iPhone 和 Android 应用程序

python - 使用 MsBuild 构建 .pyproj 时如何运行 PyLint?