1
votes

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"

2
Don't forget to mark an answer :)David Crook
@DavidCrook I remember! let me investigate the answersaph5
I'm a stickler just because we have a competition at work for most stack overflow answers :)David Crook

2 Answers

4
votes

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

1
votes

Change the target by replacing the DLL reference in your project from 4.3.1 to 4.4.0.

You'll notice that the target combo box in the project references just reads whatever this DLL version is set to. I tried this and the compute emulator ran everything fine.

You may need to install the latest .NET runtime on your cloud service according to this tutorial.