我正在使用FsXaml
以下代码
module Configurator
open System
open System.Windows
open FsXaml
type ConfigUI = XAML<"ConfigUI.xaml">
[<STAThread>]
let Main (pwszArgument : string) =
let program = new Application()
try
program.Run (new ConfigUI())
with
| :? System.IO.FileLoadException as ex -> System.Diagnostics.Debug.WriteLine ex.Message; 0
0
在 F# 代码中使用该行时program.Run (new ConfigUI())
,程序无法运行,调试窗口输出
Exception thrown: 'System.IO.FileLoadException' in uiXperience.dll
Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, 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)
但是,如果我将该行更改为(new Window())
,它可以正常工作并且我的 WPF 窗口会显示。我已经确保它ConfigUI.xaml
的FSharp.Core.dll
所有依赖项都在程序工作目录中,但我无法弄清楚为什么它无法加载程序集。
主函数从 C++ 程序外部调用,该程序使用ExecuteInDefaultAppDomain.