Ionic >=2 Windows 平台构建总是试图使用任何 CPU
Posted
技术标签:
【中文标题】Ionic >=2 Windows 平台构建总是试图使用任何 CPU【英文标题】:Ionic >=2 Windows platform build always trying to use Any CPU 【发布时间】:2017-12-13 17:53:23 【问题描述】:我有一个 Ionic 应用程序,我刚刚在仅安装了 Visual Studio 2017 的 Windows PC 上添加了 Window 平台。
在一些其他初始问题之后,我想我已经完成了最后一道障碍,那就是我在尝试构建时遇到以下错误(即运行 ionic cordova build windows)...
Building project: H:\dev\apps\mobileapps\myapp\trunk\platforms\windows\CordovaApp.Windows10.jsproj
Configuration : debug
Platform : anycpu
Patching 10 in prebuild event...
Injected base.js reference to the /www/index.html
Removing /(
*)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.WinJS.2.0\/js\/base.js">\s*<\/script>)(\s*)/ from
/www/index.html
Removing /(
*)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.Phone.WinJS.2.1\/js\/base.js">\s*<\/script>)(\s*)/
from /www/index.html
Creating library
H:\dev\apps\mobileapps\myapp\trunk\plugins\cordova-sqlite-storage\src\windows\SQLite3-Win-RT\SQLite3\SQLite3.UWP\debug\SQLite3.UWP\SQLite3.UWP.lib
and object
H:\dev\apps\mobileapps\myapp\trunk\plugins\cordova-sqlite-storage\src\windows\SQLite3-Win-RT\SQLite3\SQLite3.UWP\debug\SQLite3.UWP\SQLite3.UWP.exp
SQLite3.UWP.vcxproj ->
H:\dev\apps\mobileapps\myapp\trunk\plugins\cordova-sqlite-storage\src\windows\SQLite3-Win-RT\SQLite3\SQLite3.UWP\debug\SQLite3.UWP\SQLite3.UWP.dll
SQLite3.UWP.vcxproj ->
H:\dev\apps\mobileapps\myapp\trunk\plugins\cordova-sqlite-storage\src\windows\SQLite3-Win-RT\SQLite3\SQLite3.UWP\debug\SQLite3.UWP\SQLite3.UWP.pdb
(Partial PDB)
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\15.0\Microsoft.Common.targets\ImportBefore\Microsoft.Cpp.VCLibs120Universal.targets(103,5):
warning MSB3842: Project "CordovaApp.Windows10" depends upon SDK "Microsoft Universal CRT Debug Runtime
v10.0.15063.0" which supports apps targeting "UAP 10.0". To verify whether "Microsoft Universal CRT Debug
Runtime v10.0.15063.0" is compatible with "UAP 10.0.15063.0", contact the SDK author or see
http://go.microsoft.com/fwlink/?LinkID=309181.
[H:\dev\apps\mobileapps\myapp\trunk\platforms\windows\CordovaApp.Windows10.jsproj]
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\15.0\Microsoft.Common.targets\ImportBefore\Microsoft.Cpp.VCLibs120Universal.targets(103,5):
error MSB3779: The processor architecture of the project being built "Any CPU" is not supported by the
referenced SDK "Microsoft.UniversalCRT.Debug, Version=10.0.15063.0". Please consider changing the targeted
processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to
one of the architectures supported by the SDK: "x86, x64, ARM, ARM64".
[H:\dev\apps\mobileapps\myapp\trunk\platforms\windows\CordovaApp.Windows10.jsproj]
Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe: Command
failed with exit code 1
解决方案和项目最初确实设置了“任何 CPU”,但我已经进去尝试将其设置为 x86 和 ARM..
我已经保存了所有,我可以在 Visual Studio 中构建解决方案,但是当我进行离子构建时,它总是抱怨“任何 cpu”。
有没有人知道为什么会这样以及如何解决它?
提前致谢!
【问题讨论】:
【参考方案1】:您使用什么命令来构建项目?
如果你只使用ionic cordova build windows
,你应该添加拱标志:
ionic cordova build windows -- --arch="x64"
【讨论】:
谢谢你,它有效。多么奇怪的标志,你需要在--arch=x64
之前的“空”--
才能工作。多么奇怪。以上是关于Ionic >=2 Windows 平台构建总是试图使用任何 CPU的主要内容,如果未能解决你的问题,请参考以下文章
Ionic - 在 Windows 上为 IOS 构建(适用于最新的 IOS 和 Ionic)
Ionic / Cordova Windows 构建拾取不正确的 MSBUILD 路径
Ionic 3:更新 Cordova 等后无法构建 Android
如何使用 Windows 机器从 Ionic3 构建 .ipa 文件?