F# cannot load FSharp.Core if WPF class is changed


I am using FsXaml with the following code

module Configurator

open System
open System.Windows
open FsXaml

type ConfigUI = XAML<"ConfigUI.xaml">

let Main (pwszArgument : string) =
    let program = new Application()
        program.Run (new ConfigUI())
        | :? System.IO.FileLoadException as ex -> System.Diagnostics.Debug.WriteLine ex.Message; 0

When the line program.Run (new ConfigUI()) is used in the F# code, the program fails to run and the debug window ouputs

Exception thrown: 'System.IO.FileLoadException' in uiXperience.dll
Could not load file or assembly 'FSharp.Core, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

But if I change that line to (new Window()), it works fine and my WPF window shows. I have made sure that ConfigUI.xaml, and FSharp.Core.dll and all of it's dependencies are in the programs working directory but I cannot figure out why it fails to load the assembly.

The main function is being called externally from a C++ program which uses ExecuteInDefaultAppDomain.


0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0