I'm using Visual Studio 2017 v15.3.3. My UWP project is targeting Windows Creators Update 15063, and my Nuget packages are as follows:
My solution builds without errors, and runs fine, however I am encountering errors at design-time in my UWP app project, due to the fact that my code-behind and/or ViewModel code is referencing NuGet packages. This is what I'm seeing:
This problem is not unique to System.Reactive. I encounter a different (but seemingly related) error with the Newtonsoft.Json v10.0.3 package:
Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The bound assembly has a version that is lower than that of the request. (Exception from HRESULT: 0x80132000)
Interestingly, downgrading System.Reactive to v3.0.0 doesn't fix the issue: the error claims that the system can't find the v3.0.0 assembly.
Similar issue with the latest AutoMapper package (v6.1.1)
To reproduce the problem:
- Create a new UWP project (target whatever, it doesn't seem to matter)
- Create a new
UserControl - In the constructor of this UserControl, add some code referencing any of those packages, for example,
var s = new Subject<int>();and addusing System.Reactive.Subjects; - Add that user control as a XAML element in MainPage.xaml
- Compile and note the error
... or check out this sample here
The frustrating thing is that those big 3 packages (System.Reactive, Newtonsoft.Json, AutoMapper) all worked fine in my UWP project when it was in Visual Studio 2015 a few weeks ago before switching to VS 2017.
The only thing that has worked so far is downgrading Newtonsoft.Json from the latest v10.0.3 to v9.0.1 (downgrading to v10.0.2 or 10.0.1 did not work). Unfortunately I cannot downgrade System.Reactive as they have unlisted versions lower than 3.0
I have also tried performing a repair of my VS installation, as well as installing the mobile/xamarin components.
Any workarounds or insights would be much appreciated, since this is a blocking issue for me, thanks!


The problem is that the 3.0.0 version of
System.Reactivecan not be very compatible with UWP. And I solve this via update toSystem.Reactive 4.0.0-previewwith the following command in Package Manager Console.And you could also Disable project code in the xaml designer to solve this. For more, you could refer to Debugging or Disabling Project Code in XAML Designer.
Update
For
Newtonsoft.Json, it seems that WinRT component failed to find the correct assembly of Newton.Json. Temporarily the workaround is to manually add theNewtonsoft.json.dllfile. You can achieve this by following steps:Right click References-> Add Reference->Browse...-> Find C:\Users.nuget\packages\Newtonsoft.Json\10.0.3\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.json.dll->Click Add button. Rebuild your project and run. This error should be gone.\
And you could also use the above way to solve the
AutoMapperissue .