This is very odd.
I have two projects both F#. I've installed the latest stable (2.1.30214.0) release of RX via NUGET.
In on project everything is absolutely fine. In the other project I am basically getting errors everywhere because of the following.
Error 1 The type 'IObservable`1' is required here and is unavailable.
You must add a reference to assembly 'System.Runtime, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.`
This really doesn't make sense as the source is fine and works perfectly in VS2010.
Any suggestions?
As noted by @Mark Seemann, the problem stems from the fact that the Rx NuGet package for .NET 4.5 is actually a portable library.
Unfortunately, F# 3.0 doesn't support .NET 4.5-based portable libraries, only the legacy ones. Support for the newer portable libraries (also called .NETCore-based libraries) was added in VS 2013.
So, you have 2 options:
Build the Release45 or Debug45 target of Rx.sln in the Rx open-source release and use that instead of the Rx NuGet packages.
Use F# 3.1 which is available in Visual Studio 2013.
I have the issue too, I fixed it by editing the fsproj and replacing Net45 with Net40 in all the reactive dll paths. This is required in spite of the following in my fsproj file:
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
Original answer:
My earlier fix made the project compile but I couldn't use RX (quite pointless) but is below.
The errors are coming from the line:
open System
Now I have:
//open System
type Array = System.Array
type Double = System.Double
type TimeSpan = System.TimeSpan
All works! Horribly ugly though, and it afflicts all files in the project.
This happens when you reference the 4.5 DLLs in a 4.0 project or vice-versa. Make sure you're referencing the right version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With