4
votes

I have a class library project (VS2012, .NET Framework 4.5). I installed Rx Main 2.0.21114 using NuGet. The compile gives me a plethora of warnings of the nature:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "System.Reactive.Core, Version=2.0.20823.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5". To resolve this problem, either remove the reference "System.Reactive.Core, Version=2.0.20823.0, Culture=neutral, PublicKeyToken=f300afd708cefcd3, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

and then fails to resolve any symbols from the Rx assemblies. I have verified that the project references are pointing to the Net45 folder under the Rx install. I have gotten zero hits on Google, so I am assuming that using Rx on 4.5 is pretty straightforward. Any ideas on what is causing this issue for me?

4
Did you try just adding the System.Runtime namespace to your code?DoctorFoo
I tried adding a using System.Runtime; but that doesn't help because I am not using any types from that namespace.Aethon Invictus

4 Answers

2
votes

This usually means that somehow, the Rx 4.0 DLLs are being referenced. Nuke the references and explicitly point them to the Rx 4.5 version

2
votes

First off, note how the Rx version in the error message (2.0.20823.0) doesn't match the version you mention in your question (2.0.21114). 20823 was 4 versions ago.

More relevant, System.Runtime is an assembly that's used in Portable Class Library and Windows Store apps. That doesn't match your target, you selected the full framework. It does otherwise match with what I see from Nuget, I only see the Store version of Rx available.

It isn't clear to me how you managed to add a reference to it, I can't get it done myself. I can only guess that you somehow got a reference to an old version that you installed on your machine earlier (like 20823) and that got munged by installing the new one. Something like that, the shoe fits.

2
votes

Well, this turns out to have been some quirkiness with my current machine/VS2012 installation. We tried a vanilla project on another dev box and the same project on my box; it worked just as expected there but failed with the same messages here. I have spun up a new VM and dev environment and everything is as advertised.

Thanks for the suggestions.

1
votes

This sometimes happens in F# projects using Rx, and the fix is to reference System.ComponentModel.Composition into your project. Quirks with the portable library system I presume.