无法加载文件或程序集.核心,版本=4.0.0.0 Azure Web角色

本文关键字:Azure 角色 Web 版本 加载 文件 核心 程序集 | 更新日期: 2023-09-27 18:13:16

我已经在我的项目(http://mcapinet.codeplex.com/)中为Mailchimp添加了NuGet包,这个包依赖于FSharp。核心,所以当我安装包时,它已被添加为参考,在我的本地机器上(和Azure模拟器)一切都很好,但是当我在Azure上发布我的云服务时(注意:我正在使用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.

和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

无法加载文件或程序集.核心,版本=4.0.0.0 Azure Web角色

我已经通过引用最新的FSharp修复了这个问题。Core - 4.3.1.0和设置Copy Local为"True"

然后将此代码添加到您的web。在

之间的任何地方配置
<configuration></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>
dll应该被构建,你的错误应该被删除。