4

我正在使用Visual Studio 2015 for Cordova Tools来构建以Windows Universal(UWP)和Android为目标的应用程序。Visual Studio 2015无法为Cordova项目创建发布版本

我可以成功创建调试针对Android和UWP构建,发布构建也适用于Android。

但是Visual Studio中无法创建发布建立了UWP,没有一个Windows-AnyCPUWindows x86Windows x64Windows ARM选择工作。

当创建推出构建为Windows-AnyCPU,所述错误消息是这样的:

1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(133,5): error MSB3779: The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.NET.Native.Framework.1.2, Version=1.2". 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". [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj] 
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(133,5): error MSB3779: The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.NET.Native.Runtime.1.1, Version=1.1". 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". [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj] 
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(248,5): error MSB4062: The "IlcErrorTask" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\ilc.exe. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x86\ilc\ilc.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj] 
1>MDAVSCLI : error : Error code 1 for command: C:\Program Files (x86)\MSBuild\14.0\bin\amd64\msbuild with args: C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj,/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal,/nologo,/p:Configuration=release,/p:Platform=anycpu 
1> Command finished with error code 2: cmd /s /c ""C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\cordova\build.bat" --release "--buildConfig=C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\build.json" --archs=anycpu --win" 
1>ERROR building one of the platforms : error : cmd: Command failed with exit code 2 
1> You may not have the required environment or OS to build this project 
1>MDAVSCLI : error : cmd: Command failed with exit code 2 

当创建推出生成用于Windows x86Windows x64Windows ARM,所述错误消息是这样的:

1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(669,5): error MSB4062: The "SharedAssemblyApplicabilityVerifierTask" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj] 
1>C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets(405,5): error MSB4062: The "ComputeManagedBinaries" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\ilc.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj] 
1>MDAVSCLI : error : Error code 1 for command: C:\Program Files (x86)\MSBuild\14.0\bin\amd64\msbuild with args: C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\CordovaApp.Windows10.jsproj,/clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal,/nologo,/p:Configuration=release,/p:Platform=x64 
1> Command finished with error code 2: cmd /s /c ""C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\platforms\windows\cordova\build.bat" --release "--buildConfig=C:\Users\ztl87\Documents\Visual Studio 2015\Projects\UnihanHelper\UnihanHelper\build.json" --archs=x64 --win" 
1>ERROR building one of the platforms : error : cmd: Command failed with exit code 2 
1> You may not have the required environment or OS to build this project 
1>MDAVSCLI : error : cmd: Command failed with exit code 2 

让我困惑的是,所有这4种配置都可以正常工作调试构建。


此外,Visual Studio将停止工作,当我尝试将应用程序与Windows应用商店关联。

我使用:

  • 的Visual Studio 2015年的社区版本14.0.24720.00更新1
  • 的Visual Studio工具的Apache科尔多瓦14.0.51016.1
  • 科尔多瓦CLI版本5.4.1

我试过重新安装Visual Studio,但没有奏效。

谢谢。

回答

5

我花了好几个小时的努力,最终通过卸载节点64位和安装32位来解决这个问题。

+0

即就像一个魅力。谢谢! –

+1

当然......希望我可以更清楚地知道它为什么起作用。我刚刚注意到MSBuild是32位,我听说很多关于Node 64bit不好的东西。 – smatthews1999

+0

非常感谢!给我节省了一些时间 –

0

当我尝试将应用程序与Windows应用商店相关联时,Visual Studio停止工作。

这是2015年更新2刚刚被固定在Visual Studio中的错误下面是安装程序的链接:http://go.microsoft.com/fwlink/?LinkId=691129

1

您可以指定要构建Windows应用程序的架构和平台。

cordova build --release windows --appx=[platform] --archs=[architecture] 

选项:

  • 平台:8.1共赢,8。1-手机,UAP
  • 体系结构:86,64,臂

例如:

cordova build --release windows --appx=uap --archs=arm 

参考:https://cordova.apache.org/docs/en/latest/guide/platforms/win8/

+0

谢谢! '--arch'开关按预期工作。我不明白为什么没有记录(使用'--help'开关时甚至没有显示)。 – w1th0utnam3

+0

我也不知道。我在查看CordovaApp.Windows10.jsproj文件中的源代码时发现它 – Syclone

相关问题