本文介绍了无法加载文件或程序集FSharp.Core,版本= 4.0.0.0 Azure Web角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的项目( http://mcapinet.codeplex.com/)中为Mailchimp添加了NuGet程序包,该程序包具有依赖于FSharp.Core,因此在我在本地计算机(和Azure仿真器)上安装软件包时,已将其添加为参考,一切正常,但是当我在Azure上发布Cloud Service时(请注意:我正在使用持续部署使用Visual Studio Online)进入网站时出现此错误:

I've added NuGet package for Mailchimp in my project (http://mcapinet.codeplex.com/) this package has dependence on FSharp.Core, so it has been added as reference when I installed package, on my local machine (and with Azure Emulator) everything works fine, but when I published my Cloud Service on Azure (note: I'm using Continuous deployment with Visual Studio Online) I got this error when I went to website:

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.

并且FSharp.Core的属性本地复制"设置为True.

And FSharp.Core's property "Copy local" is set to True.

我该如何解决?

编辑

在部署过程中,我会看到以下警告:

During my deployment I can see this warning:

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

推荐答案

我已通过引用最新的FSharp.Core-4.3.1.0并将复制本地"设置为真"来解决此问题.

I have fixed this issue by referencing the latest FSharp.Core - 4.3.1.0 and setting Copy Local to 'True'.

然后将此代码添加到您的web.config中

Then add this code to your web.config anywhere between the

<configuration></configuration>

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

tags to bind all older versions to the new assembly.

<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>

然后应编译dll,并清除错误.

The dll should then be build and your error should be removed.

这篇关于无法加载文件或程序集FSharp.Core,版本= 4.0.0.0 Azure Web角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 06:34