Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly FSharp.Core, Version=4.0.0.0 Azure Web Role

Tags:

c#

azure

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.

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

How can I solve this ?

EDIT

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
like image 450
hyperN Avatar asked Jul 17 '14 10:07

hyperN


1 Answers

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

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>

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

like image 120
Deanus69 Avatar answered Oct 09 '22 20:10

Deanus69