Skip to content

Type providers fail when only FSharp.Core 4.3.1.0 is installed #398

@tpetricek

Description

@tpetricek

If you have a new Windows machine and follow the installation instructions on fsharp.org, you'll end up with a computer that has only FSharp.Core 4.3.1.0. For example:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe" /l FSharp.Core

Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.33440
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  FSharp.Core, Version=2.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
  FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

When you then try to use some of the type providers, you get an error akin to:

The type provider 'ProviderImplementation.WorldBankProvider' reported an error: The type provider constructor has thrown an exception: Cannot resolve dependency to assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.

The solution would be to add binding redirect mapping 4.3.0.0 to 4.3.1.0. But where? If you want to use type providers in VS, do you have to add binding redirect to devenv.exe.config and to fsi.exe.config? Or to machine.config (but what if you have to ask system admin to do this)? Or is there a better solution? (AFAIK, there is no way to install standalone redist of FSharp.Core 4.3.0.0....) Or should the type provider handle this somehow?

Any help would be appreciated!

EDIT: Another attempt to solve this was to add reference to F# 4.3.0.0 NuGet package but that does not help either.

EDIT 2: I have to admit, I absolutely do not understand how versioning of FSharp.Core works these days and how (not) referencing different versions changes what the compiler does. Maybe I'm just stupid, but maybe this is just completely broken (?) if I just cannot understand it...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions