.NET runtime tries to load FSharp.Core 4.3.0 even if all projects reference 4.3.1

后端 未结 1 1363
忘掉有多难
忘掉有多难 2020-12-09 17:04

I\'ve created a project in F# that targets F# 3.1 runtime (that is, FSharp.Core version 4.3.1). Then I\'ve created a console C# application, added a project reference to my

相关标签:
1条回答
  • 2020-12-09 18:10

    This is the wild guess but based on the exception you get it's likely that you have other FSharp assemblies inside your project.

    So the error indicates that one of the dependencies you're using requires FSharp.Core 4.3.0.0. Let's say your project references other FSharp dependencies like for example FSharp.Data 2.2.0.0. Even, if you have added an explicit reference in your own project to FSharp.Core 4.3.1.0 this won't work becasue FSharp.Data 2.2.0.0 was built against FSharp.Core 4.3.0.0. To fix that you need to add a bindingRedirect into your project configuration file app.config :

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>
    

    This should fix the issue.

    0 讨论(0)
提交回复
热议问题