Jamie Dixon
Jamie Dixon

Reputation: 4282

Azure Web Job: Could not load file or assembly 'FSharp.Core, Version=4.5.0.0

I have some Azure Web Jobs that I am upgrading to the latest version of FSharp. I am using Visual Studio 2017 to create FSharp Console apps that get run in the web job. Here is the project's properties:

enter image description here

When I run the job, I am seeing this in the log: [09/21/2018 16:01:39

99459b: ERR ] Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I tried adding this in the .config and it did not help:

  <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.5.0.0" newVersion="4.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>  

When I change the .config to this

  <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.5.0.0" newVersion="4.4.3.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>  

I get this error

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=4.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Upvotes: 1

Views: 436

Answers (1)

Jamie Dixon
Jamie Dixon

Reputation: 4282

So I fixed it by unload this FSharp project and removing this line:

<TargetFSharpCoreVersion>4.4.3.0</TargetFSharpCoreVersion>

Then the project page looks like this: enter image description here

I then went to references and deleted the broken 4.4.3 reference enter image description here

I then added a reference to the project (old fashion way) and navigated to the nuget folder (users/.nuget/FSharp/etc...) and made that reference. Marked it "Copy Always" and it worked

Upvotes: 1

Related Questions