diff --git a/src/Microsoft.FSharp.Compiler/Program.fs b/src/Microsoft.FSharp.Compiler/Program.fs index 0a254518203..051a8f6f309 100644 --- a/src/Microsoft.FSharp.Compiler/Program.fs +++ b/src/Microsoft.FSharp.Compiler/Program.fs @@ -1,2 +1,2 @@ [] -let main _ = 0 \ No newline at end of file +let main _ = 0 diff --git a/src/fsi/fsimain.fs b/src/fsi/fsimain.fs index 57aee5ca360..d4394269ff4 100644 --- a/src/fsi/fsimain.fs +++ b/src/fsi/fsimain.fs @@ -394,16 +394,23 @@ let MainMain argv = || x = "/shadowcopyreferences+" || x = "--shadowcopyreferences+") - if + let executeFsi shadowCopyFiles = + if shadowCopyFiles then + let setupInformation = AppDomain.CurrentDomain.SetupInformation + setupInformation.ShadowCopyFiles <- "true" + let helper = AppDomain.CreateDomain("FSI_Domain", null, setupInformation) + helper.ExecuteAssemblyByName(Assembly.GetExecutingAssembly().GetName()) + else + evaluateSession (argv) + + let tryShadowCopy = AppDomain.CurrentDomain.IsDefaultAppDomain() && argv |> Array.exists isShadowCopy - then - let setupInformation = AppDomain.CurrentDomain.SetupInformation - setupInformation.ShadowCopyFiles <- "true" - let helper = AppDomain.CreateDomain("FSI_Domain", null, setupInformation) - helper.ExecuteAssemblyByName(Assembly.GetExecutingAssembly().GetName()) - else - evaluateSession (argv) + + try + executeFsi tryShadowCopy + with :? FileLoadException -> + executeFsi false #else evaluateSession (argv) #endif