Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft.NETCore.UniversalWindowsPlatform 5.2.2 Nuget Update Fails

I'm trying to update the Microsoft.NETCore.UniversalWindowsPlatform Nuget in my project but am unable to do so. I'm currently on 5.1.0, and I am attempting to update to 5.2.2. The output when I attempt to update looks like this:

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 ==========

I'm not really sure how to interpret this error message. Is it saying reflection is not supported on UWP?

I've tried clearing my nuget cache and restoring. I have also tried uninstalling 5.1.0 and just installing straight to 5.2.2. I'm using Nuget version 3.4.4 and VS 2015. I should also probably mention that I have been able to update the nuget for some other projects within the same solution without an issue. In case it's relevant my Universal Windows Minimum version is (10.0; Build 10240) and my Target version is (10.0; Build 10586)

Any idea what is going awry here?

like image 548
Shayon Avatar asked Feb 07 '23 10:02

Shayon


2 Answers

This worked for me:

  1. Delete all references to other projects in the solution.
  2. Uninstall all nuget packages (remember which ones you had installed).
  3. Add the nuget packages back, starting with the Microsoft.NETCore.UniversalWindowsPlatform 5.2.2 package.
  4. Do steps 1 through 3 for all projects in the solution
  5. Add back all necessary project references for each project in the solution.

Following this procedure is what allowed me to update the Microsoft.NETCore.UniversalWindowsPlatform package as well as all other packages that gave me the same error, like Automapper 4.2.1 to 5.0.2.

like image 90
Jim Gilmartin Avatar answered Feb 09 '23 00:02

Jim Gilmartin


Updating to Microsoft.NETCore.UniversalWindowsPlatform : 5.2.2 is the right fix. This package is required whenever dealing with packages that use netstandard.

like image 27
TheESJ Avatar answered Feb 08 '23 23:02

TheESJ