我正在尝试按照本教程使用Visual Studio 2015构建Cordova应用程序:http://taco.visualstudio.com/m/docs/tutorial-gulp-readme/,
我将config.xml中的Windows目标版本设置为10.0。当我运行gulp时,构建任务因以下错误而停止:
C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(247,5): error : .NET Native requires an architecture specific Target Platform. Using the 'AnyCPU' Target Platform with .NET Native is not supported. Please ensure the 'UseDotNetNativeToolchain' property is set to false for 'AnyCPU' builds. [E:\App-Path\App-Path\platforms\windows\CordovaApp.Windows10.jsproj]
ERROR: Error code 1 for command: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild with args: E:\App-Path\App-Path\platforms\windows\CordovaApp.Windows10.jsproj,/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal,/nologo,/p:Configuration=release,/p:Platform=anycpu
Process terminated with code 1.
随后,我编辑了E:\ App-Path \ App-Path \ platforms \ windows \ CordovaApp.Windows10.jsproj,现在就说了
<ProjectConfiguration Include="Release|AnyCPU">
<Configuration>Release</Configuration>
<Platform>AnyCPU</Platform>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
</ProjectConfiguration>
然而,错误仍然不会消失。我做错了什么?
答案 0 :(得分:2)
您无法使用AnyCPU构建Windows 10作为您的体系结构,您必须以x86或x64为目标。
要解决此问题,请将您的gulp任务更改为构建x86而不是AnyCPU。以下是我如何修改gulp目标以使用Windows 10:
gulp.task("default", function (callback) {
cordova.build({
"platforms": ["windows"],
"options": ["--release", "--archs=x86"]
}, callback);
});
如果查看\ platforms \ windows \ cordova \ lib \ build.js,您将看到可以传递给Windows构建任务的完整参数列表。
希望有所帮助!