diff --git a/src/compiler/WebSharper.MSBuild/WebSharperTask.fs b/src/compiler/WebSharper.MSBuild/WebSharperTask.fs index 050399274..a9edaf3a3 100644 --- a/src/compiler/WebSharper.MSBuild/WebSharperTask.fs +++ b/src/compiler/WebSharper.MSBuild/WebSharperTask.fs @@ -423,13 +423,14 @@ type WebSharperTask() = let dir = Path.GetDirectoryName(loc) let setup = AppDomainSetup(ConfigurationFile = Path.Combine(dir, config)) let ad = AppDomain.CreateDomain("WebSharperBuild", null, setup) - let proxy = - // Force loading the right FSharp.Core.dll. - let fscore = - this.ItemInput |> Array.find (fun x -> - Path.GetFileNameWithoutExtension(x.ItemSpec) - .ToLowerInvariant() = "fsharp.core") + // Force loading the right FSharp.Core.dll. + this.ItemInput + |> Array.tryFind (fun x -> + Path.GetFileNameWithoutExtension(x.ItemSpec) + .ToLowerInvariant() = "fsharp.core") + |> Option.iter (fun fscore -> ad.CreateInstanceFrom(fscore.ItemSpec, typeof.FullName) + |> ignore) let t = ad.CreateInstanceFromAndUnwrap(loc, typeof.FullName, false, BindingFlags.CreateInstance, null, [||], null, null) :?> Settings t, Some ad let res = this.DoExecute settings