If you’ve ever tried to use an F# class library from an ASP.NET application, you may find that although things work perfectly when you are running locally, your web app won’t load at all in production.
Could not load file or assembly ‘FSharp.Core, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
Fortunately, the fix is easy. All you need to do is add a reference to FSharp.Core to your web project, and set its Copy Local property to True. Not familiar with how to do that? Here’s a quick overview.
First, go to the Solution Explorer and right-click on your web project, or on your web project’s References folder, and select Add Reference…
In the Reference Manager window, select Assemblies, and the find the FSharp.Core, version 4.3 reference. Check it, and click OK.
Finally, in the Solution Explorer, find the FSharp.Core reference in your project’s References folder. Select it, then open the Properties window (or tab, or pane, depending on how you have Visual Studio configured), and set Copy Local to True.
That’s it! Deploy your web app to your server, and the error will be gone.