无法加载文件或程序集FSharp.Core,Version = 4.0.0.0 Azure Web Role

hyp*_*erN 6 c# azure

我已经在我的项目(http://mcapinet.codeplex.com/)中为Mailchimp添加了NuGet包,这个包依赖于FSharp.Core,所以当我在本地机器上安装包时,它已被添加为参考(和一切正常,但是当我在Azure上发布我的Cloud Service时(注意:我正在使用Visual Studio Online进行持续部署),当我访问网站时出现此错误:

Could not load file or assembly 'FSharp.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

并且FSharp.Core的属性"Copy local"设置为True.

我怎么解决这个问题?

编辑

在我的部署期间,我可以看到此警告:

The project 'Interface.Web' is dependent on the following assembly: C:\a\src\TFS\packages\FSharp.Core.4.0.0\lib\FSharp.Core.dll. This assembly is not in the package. To make sure that the role starts, add this assembly as a reference to the project and set the Copy Local property to true
Run Code Online (Sandbox Code Playgroud)

小智 4

我通过引用最新的 FSharp.Core - 4.3.1.0 并将“复制本地”设置为“True”解决了此问题。

然后将此代码添加到 web.config 之间的任意位置

<configuration></configuration>
Run Code Online (Sandbox Code Playgroud)

标签将所有旧版本绑定到新程序集。

<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>
Run Code Online (Sandbox Code Playgroud)

然后应该构建 dll 并且您的错误应该被删除。