Reputation: 4302
I created a new WebAPI project that references a component that I wrote in F#. I works fine on my local workstation. When I deploy it to Windows Azure, I am getting this:
<Error><Message>An error has occurred.</Message><ExceptionMessage>Could not load file or assembly 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.</ExceptionMessage><ExceptionType>System.IO.FileNotFoundException</ExceptionType><StackTrace> at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()</StackTrace></Error>
Does anyone have any suggestions? I set the F# .dlls to copy local.
Upvotes: 3
Views: 543
Reputation: 233397
Although F# is a wonderful language, the framework support is frankly a mess. FSharp.Core doesn't ship with the normal .NET framework, but as a separate installer (e.g. this one, for F# 3.1.1). By the looks of it, the Windows Azure OS images don't have F# installed at all, or at least not the version your code is compiled against.
Here's more information about the F# versioning scheme.
When the necessary version of FSharp.Core isn't available on the target computer (as is currently the case on Windows Azure), you must include FSharp.Core.dll in the package you upload. Here's more information about running an F# ASP.NET Web API service on Azure. Among other things, you must be sure to set the Build Action correctly in Visual Studio.
Upvotes: 4
Reputation: 1749
Add the F# .dlls to the main WebAPI project too. Otherwise it does not get included in the package uploaded to Azure.
Upvotes: 1