7

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
hyperN
  • 2,674
  • 9
  • 54
  • 92
  • Your really need to add reference for the `FSharp.Core` to the `Interface.Web`. – VMAtm Jul 17 '14 at 11:39
  • But I can see it under references and Copy Local is set to true, or am I doing smth. wrong ? – hyperN Jul 17 '14 at 11:41
  • Try to remove it and add another time. May be it's a NuGet Manager bug. – VMAtm Jul 17 '14 at 11:44
  • Already did that, but with no luck – hyperN Jul 17 '14 at 11:44
  • Try to examine the resulting package, are there this library? – VMAtm Jul 17 '14 at 11:45
  • Yes, there is, and everything works fine locally, but for some reason FSharp.Core isn't copied during deployment – hyperN Jul 17 '14 at 11:47
  • There are two libraries there - for 2.0 and 4.0 .NET frameworks. Are you sure they aren't overlapping eachover? – VMAtm Jul 17 '14 at 11:54
  • I'm not referencig 2.0 at all only this one – hyperN Jul 17 '14 at 12:07
  • https://www.nuget.org/packages/mcapi.net - but here they are referenced. – VMAtm Jul 17 '14 at 12:08
  • But aren't they referenced depending on my .net version I'm using (In my case 4.5), I don't see 2.0 in my references and I don't get any errors / warnings about it – hyperN Jul 17 '14 at 12:22
  • 1
    If you are using NuGet package for it, they can overlap as the NUGet package can contain two versions for each .NET framework. That's all I can say for now, sorry. – VMAtm Jul 17 '14 at 12:24

1 Answers1

4

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.

Deanus69
  • 41
  • 2
  • Copy Local to 'True' has been set all along, couldn't fix the problem so I decided to use another MailChimp library – hyperN Sep 03 '14 at 07:43