2016-08-03 103 views
4

我想在我的項目中更新Microsoft.NETCore.UniversalWindowsPlatform Nuget,但我無法這樣做。我目前在5.1.0上,並且正在嘗試更新到5.2.2。我嘗試更新時的輸出如下所示:Microsoft.NETCore.UniversalWindowsPlatform 5.2.2 Nuget更新失敗

Restoring packages for 'MyApp'. 
Restoring packages for C:\Users\Shayon\uwp\src\MyApp\project.json... 
System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot. 
Some packages are not compatible with UAP,Version=v10.0 (win10-arm-aot). 
System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot. 
Some packages are not compatible with UAP,Version=v10.0 (win10-x64-aot). 
System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot. 
Some packages are not compatible with UAP,Version=v10.0 (win10-x86-aot). 
Package restore failed for 'MyApp'. 
Package restore failed. Rolling back package changes for 'MyApp'. 
========== Finished ========== 

我不太確定如何解釋此錯誤消息。是否說UWP不支持反射?

我試過清理我的nuget緩存並恢復。我也嘗試卸載5.1.0並直接安裝到5.2.2。我使用的是Nuget版本3.4.4和VS 2015.我也應該提到,我已經能夠在同一個解決方案中更新nuget,以解決其他一些問題。如果這是我的有關萬能的Windows最低版本(10.0; Build 10240),我的目標版本是(10.0; Build 10586)

任何想法是怎麼回事出錯嗎?

回答

6

這爲我工作:

  1. 刪除解決其他項目的所有引用。
  2. 卸載所有nuget軟件包(請記住您已安裝哪些軟件包)
  3. 添加nuget包,從Microsoft.NETCore.UniversalWindowsPlatform 5.2.2包開始。
  4. 對解決方案中的所有項目執行步驟1到3
  5. 爲解決方案中的每個項目添加所有必需的項目參考。

按照這個步驟,我可以更新Microsoft.NETCore.UniversalWindowsPlatform軟件包以及所有其他軟件包,例如Automapper 4.2.1到5.0.2。

+1

這對我有用,但不幸的是,這不得不更新框架。 – CrusherJoe

2

更新到Microsoft.NETCore.UniversalWindowsPlatform:5.2.2是正確的修復方法。在處理使用netstandard的軟件包時,這個軟件包是必需的。