Search code examples
azuref#azure-worker-roles

F# Azure Worker Role and Target runtime


I'm using the latest Azure SDK 2.7 and when I create new Cloud Service and add F# worker role, then Im unable to change target runtime. Its set to F# 3.1 / FSharp.Core 4.3.1

Is there any trick how can I use F# 4.0 for worker roles?

SOLUTION:

In order to make your F# WorkerRole work with other F# libs which were compiled against different F# version, do the following:

  • remove FSharp.Core dependency from your worker role project (Target Runtime will be set then to N/A)

  • add assembly redirect

    assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0"


Solution

  • What I often find is that F# interaction with architectural components has a tendency to lag behind. To resolve this, I always wrap my F# components with C#.

    I look at C# as my architectural glue while F# does the real work:

    1. Create a Cloud Service and Add a C# Worker Role
    2. Create an F# Library
    3. Add a reference to the C# worker role for the F# Library.

    Solution View

    enter image description here

    Consuming the Library from C#

    enter image description here

    F# Library Definition

    enter image description here