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

相關問題