anchor.diff:                  | Some x -> RelativeDllReference x.Value
                   | None -> Another
           | _ -> Another
  -    if not(File.Exists(projFile)) then
  -        failwith ("File does not exist: " + projFile)
  -    let doc = XDocument.Load(projFile)
  +    let xmlDoc =
  +        match xmlDoc with
  +        | Some doc -> doc
  +        | None ->
  +            if not(File.Exists(projFile)) then
  +                failwith ("File does not exist: " + projFile)
  +            XDocument.Load(projFile)
       let projDir = Path.GetDirectoryName(projFile) |> Path.normalizePath
       let sourceFiles, projectReferences, relativeDllReferences =
  -        doc.Root.Elements()
  +        xmlDoc.Root.Elements()
           |> withName "ItemGroup"
           |> Seq.map (fun item ->
               (item.Elements(), ([], [], []))
  
positive.code:             // Duplicated items will be removed later
              crackedFsproj::acc
          | None ->
              let crackedFsproj = crackFsproj projFile
              let paketProjRefs, paketDllRefs =
                  getPaketRefs paketDir targetFramework projFile
                  |> partitionMap (function
  
negative.code:         yield "-r:" + fableCoreLib // "FSharp.Core"
      |]
  
  let tryGetTargetFramework (xmlDoc: XDocument) =
      xmlDoc.Root.Elements()
      |> Seq.tryPick (fun el ->
          if el.Name.LocalName = "PropertyGroup" then
              el.Elements() |> Seq.tryPick (fun el ->
                  if el.Name.LocalName = "TargetFramework"
                  then Some el.Value
                  else None)
          else None)
  
  /// Ultra-simplistic resolution of .fsproj files
  let crackFsproj (projFile: string) (xmlDoc: XDocument option) =
      let withName s (xs: XElement seq) =
          xs |> Seq.filter (fun x -> x.Name.LocalName = s)
      let (|BeforeComma|) (att: XAttribute) =
  