anchor.diff:                      printfn "package resolution completed at %A" System.DateTimeOffset.UtcNow
                       Solved loadScript
   
  +let getLoadScript baseDir packageManagerLoadScriptSubDirectory loadScriptName =
  +  System.IO.Path.Combine(baseDir, packageManagerLoadScriptSubDirectory, loadScriptName)
  +
  +/// Resolves absolute load script location: something like
  +/// baseDir/.paket/load/scriptName
  +/// or
  +/// baseDir/.paket/load/frameworkDir/scriptName 
  +let GetPaketLoadScriptLocation baseDir optionalFrameworkDir scriptName =
  +  let paketLoadFolder = System.IO.Path.Combine(Internals.PM_DIR,"load")
  +  getLoadScript
  +    baseDir
  +    (match optionalFrameworkDir with | None -> paketLoadFolder | Some frameworkDir -> System.IO.Path.Combine(paketLoadFolder, frameworkDir))
  +    scriptName
  
positive.code: // Copyright (c) Microsoft Corporation.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
  
  /// Coordinating compiler operations - configuration, loading initial context, reporting errors etc.
  module internal Microsoft.FSharp.Compiler.ReferenceLoading.PaketHandler
  
  type ReferenceLoadingResult =
  | Solved of loadingScript: string
  | PackageManagerNotFound of implicitIncludeDir: string * userProfile: string
  | PackageResolutionFailed of toolPath: string * workingDir: string * msg : string
  
  module Internals =
      open System
      open System.IO
      let TargetFramework = "net461"
      let PM_EXE = "paket.exe"
      let PM_DIR = ".paket"
      let PM_SPEC_FILE = "paket.dependencies"
      let PM_LOCK_FILE = "paket.lock"
      let getPackageManagerCommand rootDir = "install --generate-load-scripts load-script-type fsx load-script-framework " + TargetFramework + " project-root \""  + Path.GetFullPath rootDir + "\""
      let PM_LOADSCRIPT = Path.Combine(PM_DIR, "load", TargetFramework, "main.group.fsx")
  
      let userProfile = 
          let res = Environment.GetEnvironmentVariable("USERPROFILE")
          if System.String.IsNullOrEmpty res then
              Environment.GetEnvironmentVariable("HOME")
  
negative.code:         |> Seq.choose getPaketAndExe
          |> Seq.tryHead
  
      /// Resolve packages loaded into scripts using `paket:` in `#r` directives such as `#r @"paket: nuget AmazingNugetPackage"`. 
      /// <remarks>The result is either `ReferenceLoadingResult.Solved` or some of the failing cases.</remarks>
      /// <param name="targetFramework">A string given to paket command to fix the framewor.k</param>
      /// <param name="getCommand">Prepares the full `paket.exe` command, given the targetFramework.</param>
      /// <param name="getRelativeLoadScriptLocation">Resolves the path (based from the passed working dir, which is temporary) to the load script.</param>
      /// <param name="alterToolPath">Function which prefixes the whole command, some platforms such as mono requires invocation of `mono ` as prefix to the full `paket.exe` command.</param>
      // TODO: comment the remaining parameters
      let ResolvePackages targetFramework getCommand getRelativeLoadScriptLocation alterToolPath (implicitIncludeDir: string, scriptName: string, packageManagerTextLines: string list) =
          let workingDir = Path.Combine(Path.GetTempPath(), "script-packages", string(abs(hash (implicitIncludeDir,scriptName))))
          let workingDirSpecFile = FileInfo(Path.Combine(workingDir,PM_SPEC_FILE))
          if not (Directory.Exists workingDir) then
              Directory.CreateDirectory workingDir |> ignore
  