F # 1.9.9, ОС - WinXP
Я пытаюсь сделать это с помощью двух версий кода, но получаю ошибки в обоих случаях.
UPDATE.
dir on "D:\Sources\ATProjectChecker\ATProjectChecker\tests\asms"
содержит FSharp.Core.dll
и mscorlib.dll
SerializationException: type is not allowed (my translation from russian)<br> "TestLoader+cross_dlg@135,ATProjectChecker, Version=0.0.0.0, Culture=neutral, <br>PublicKeyToken=null".
let load_run_unload path =
let dlg () : unit =
let name = System.Reflection.AssemblyName.GetAssemblyName(path)
let asm = System.Reflection.Assembly.LoadFile path
//let asm = System.Reflection.Assembly.ReflectionOnlyLoad(name.FullName)
//let run = asm.GetType("Test").GetMethod("run")
//let run () = run.Invoke(null, [||])
//ignore( run() )
()
let dsetup = new System.AppDomainSetup()
dsetup.ApplicationBase <- @"D:\Sources\ATProjectChecker\ATProjectChecker\tests\asms" //__SOURCE_DIRECTORY__
dsetup.ShadowCopyFiles <- "true"
let evil = System.AppDomain.CurrentDomain.Evidence
let tmp_domain = System.AppDomain.CreateDomain("TmpDomain", evil, dsetup)
let cross_dlg = new System.CrossAppDomainDelegate( dlg )
tmp_domain.DoCallBack( cross_dlg )