anchor.diff:  open System.Threading
   open System.Text.RegularExpressions
   open System.Xml.Linq
  +open Yaaf.FSharp.Scripting
   
   let private FSIPath = @".\tools\FSharp\;.\lib\FSharp\;[ProgramFilesX86]\Microsoft SDKs\F#\4.0\Framework\v4.0;[ProgramFilesX86]\Microsoft SDKs\F#\3.1\Framework\v4.0;[ProgramFilesX86]\Microsoft SDKs\F#\3.0\Framework\v4.0;[ProgramFiles]\Microsoft F#\v4.0\;[ProgramFilesX86]\Microsoft F#\v4.0\;[ProgramFiles]\FSharp-2.0.0.0\bin\;[ProgramFilesX86]\FSharp-2.0.0.0\bin\;[ProgramFiles]\FSharp-1.9.9.9\bin\;[ProgramFilesX86]\FSharp-1.9.9.9\bin\"
   
  
positive.code:                     if printDetails then trace "Cache doesn't exist"
              else
                  if printDetails then trace "Cache doesn't exist"
          try
              let session = FsiEvaluationSession.Create(fsiConfig, options, stdin, outStream, errStream)
              try
                  session.EvalScript scriptPath
  
                  try
                      if useCache && not cacheValid.Value then
                          let assemBuilder = session.DynamicAssembly :?> System.Reflection.Emit.AssemblyBuilder
                          assemBuilder.Save("FSI-ASSEMBLY.dll")
                          if not <| Directory.Exists cacheDir.FullName then
                              let di = Directory.CreateDirectory cacheDir.FullName 
                              di.Attributes <- FileAttributes.Directory ||| FileAttributes.Hidden
  
                          let destinationFile = FileInfo(assemblyPath.Value)
                          let targetDirectory = destinationFile.Directory
  
                          if (not <| targetDirectory.Exists) then targetDirectory.Create()
                          if (destinationFile.Exists) then destinationFile.Delete()
  
                          File.Move("FSI-ASSEMBLY.dll", assemblyPath.Value)
                      
                          if File.Exists("FSI-ASSEMBLY.pdb") then
                              File.Delete("FSI-ASSEMBLY.pdb")
                          if File.Exists("FSI-ASSEMBLY.dll.mdb") then
                              File.Delete("FSI-ASSEMBLY.dll.mdb")
  
                          let dynamicAssemblies = 
                              System.AppDomain.CurrentDomain.GetAssemblies()
                              |> Seq.filter(fun assem -> assem.IsDynamic)
                              |> Seq.map(fun assem -> assem.GetName().Name)
                              |> Seq.filter(fun assem -> assem <> "FSI-ASSEMBLY")
                              // General Reflection.Emit helper (most likely harmless to ignore)
                              |> Seq.filter(fun assem -> assem <> "Anonymously Hosted DynamicMethods Assembly")
                              // RazorEngine generated
                              |> Seq.filter(fun assem -> assem <> "RazorEngine.Compilation.ImpromptuInterfaceDynamicAssembly")
                              |> Seq.cache
                          if dynamicAssemblies |> Seq.length > 0 then
                              let msg =
                                  sprintf "Dynamic assemblies were generated during evaluation of script (%s).\nCan not save cache." 
                                      (System.String.Join(", ", dynamicAssemblies))
                              trace msg
  
                          else
                              let assemblies = 
                                  System.AppDomain.CurrentDomain.GetAssemblies()
                                  |> Seq.filter(fun assem -> not assem.IsDynamic)
                                  // They are not dynamic, but can't be re-used either.
                                  |> Seq.filter(fun assem -> not <| assem.GetName().Name.StartsWith("CompiledRazorTemplates.Dynamic.RazorEngine_"))
                          
                              let cacheConfig : XDocument = Cache.create assemblies
                              cacheConfig.Save(cacheConfigPath.Value) 
                              if printDetails then trace (System.Environment.NewLine + "Saved cache")
                  with 
                  | ex ->
                      handleException ex
                      reraise()
                  // TODO: Reactivate when FCS don't show output any more 
                  // handleMessages()
                  true
              with
              | _ex ->
                  handleMessages()
                  false
          with
          | exn ->
              traceError "FsiEvaluationSession could not be created."
              traceError <| sbErr.ToString()
              raise exn
  
  /// Run the given buildscript with fsi.exe and allows for extra arguments to the script. Returns output.
  let executeBuildScriptWithArgsAndReturnMessages script (scriptArgs: string[]) useCache cleanCache =
      let messages = ref []
      let appendMessage isError msg =
          messages := { IsError = isError
                        Message = msg
                        Timestamp = DateTimeOffset.UtcNow } :: !messages
  
negative.code:                     cacheDir.GetFiles()
                      |> Seq.filter(fun file -> 
                          let oldScriptName, _ = getScriptAndHash(file.Name)
                          oldScriptName = cacheInfo.ScriptFileName)
  
                  if (oldFiles |> Seq.length) > 0 then
                      if cleanCache then
  