anchor.diff:          if not (proj.References |> List.exists ((=) refr)) then proj else
           { proj with References = proj.References |> List.filter ((<>) refr) }
   
  -
  -
  -// eventually the xelems that Forge manages will be removed from the overarching
  -// xelem, the remaining nodes will be stored for later
  -// after forge is done managing the project AST it will xform to an xelment and
  -// add this back to the stored nodes.
  -
  -let readfsproj path =
  -    let print sqs = sqs |> Seq.iter ^ printfn "%A"
  -
  -    printfn "parsing - %s" path
  -    use reader = XmlReader.Create  path
  -    let xdoc   = (reader |> XDocument.Load).Root
  -    
  -    let itemGroups = XElem.descendantsNamed "ItemGroup" xdoc
  -
  -    let projectSettingsSqs = 
  -        XElem.descendantsNamed "PropertyGroup" xdoc
  -        |> Seq.filter (fun pg -> not ^ XElem.hasAttribute "Condition" pg)
  -        
  -    let projectSettings = projectSettingsSqs |> Seq.head |> ProjectSettings.fromXElem
  -
  -//    let buildConfigs = 
  -//        XElem.descendantsNamed "PropertyGroup" xdoc
  -//        |> Seq.filter (fun pg -> XElem.hasAttribute "Condition" pg)
  -
  -    let projectReferences = 
  -        XElem.descendantsNamed "ProjectReference" xdoc
  -        |> Seq.map ProjectReference.fromXElem
  -
  -    let filterItems name =
  -        itemGroups |> Seq.collect ^ XElem.descendantsNamed name
  -
  -    let references = 
  -        filterItems "Reference"
  -        |> Seq.filter  (not << XElem.hasElement "Paket") // we only manage references paket isn't already managing
  -        |> Seq.map Reference.fromXElem
  -    
  -    let srcFiles = 
  -        itemGroups  
  -        |> Seq.collect (fun itemgroup -> 
  -            XElem.descendants itemgroup 
  -            |> Seq.filter (fun x -> isSrcFile x.Name.LocalName)) 
  -        |> Seq.map SourceFile.fromXElem
  -
  -//    printfn "\n - PROJECT SETTINGS - \n"
  -//    print [projectSettings]
  -//    printfn "\n - PROPERTY GROUPS - \n"    
  -//    print propertyGroups
  -//    printfn "\n - PROJECT REFERENCES - \n"
  -//    print projectReferences
  -//    printfn "\n - REFERENCES - \n"
  -//    print references
  -//    printfn "\n - SOURCE FILES - \n"
  -//    print srcFiles
  -    let proj =
  -        {   ToolsVersion      =  XElem.getAttribute "ToolsVersion" xdoc |> XAttr.value
  -            DefaultTargets    =  [XElem.getAttribute "DefaultTargets" xdoc |> XAttr.value]
  -            References        = references |> List.ofSeq
  -            Settings          = projectSettings
  -            SourceFiles       = srcFiles |> Seq.map File |> List.ofSeq
  -            ProjectReferences = projectReferences |> List.ofSeq
  -            BuildConfigs      = []        
  -        }
  -
  -    proj
  -
  -  
  -
  -
  +    let addFile (file : SourceElement) (proj:FsProject) =
  +        if proj.SourceFiles |> List.exists ((=) file) then proj else
  +        { proj with SourceFiles = file::proj.SourceFiles }
  +
  +    let removeFile (file : SourceElement) (proj:FsProject) =
  +        if not (proj.SourceFiles |> List.exists ((=) file)) then proj else
  +        { proj with SourceFiles = proj.SourceFiles |> List.filter ((<>) file) }
  +
  +    let orderFile (fileToMove : SourceElement) (putBefore : SourceElement) (proj : FsProject) =
  +         if not (proj.SourceFiles |> List.exists ((=) fileToMove) ||proj.SourceFiles |> List.exists ((=) putBefore)) then proj else
  +         let filesBefore = proj.SourceFiles |> List.filter ((<>) fileToMove) |> List.takeWhile ((<>) putBefore)
  +         let filesAfter = proj.SourceFiles |> List.filter ((<>) fileToMove) |> List.skipWhile ((<>) putBefore)
  +         let filesNew = seq {yield! filesBefore; yield fileToMove; yield! filesAfter } |> Seq.toList
  +         { proj with SourceFiles = filesNew }
  +
  +    let parse content =
  +        let xdoc = (XDocument.Parse content).Root
  +        let itemGroups = XElem.descendantsNamed "ItemGroup" xdoc
  +
  +        let projectSettingsSqs =
  +            XElem.descendantsNamed "PropertyGroup" xdoc
  +            |> Seq.filter (fun pg -> not ^ XElem.hasAttribute "Condition" pg)
  +
  +        let projectSettings = projectSettingsSqs |> Seq.head |> ProjectSettings.fromXElem
  +
  +    //    let buildConfigs =
  +    //        XElem.descendantsNamed "PropertyGroup" xdoc
  +    //        |> Seq.filter (fun pg -> XElem.hasAttribute "Condition" pg)
  +
  +        let projectReferences =
  +            XElem.descendantsNamed "ProjectReference" xdoc
  +            |> Seq.map ProjectReference.fromXElem
  +
  +        let filterItems name =
  +            itemGroups |> Seq.collect ^ XElem.descendantsNamed name
  +
  +        let references =
  +            filterItems "Reference"
  +            |> Seq.filter  (not << XElem.hasElement "Paket") // we only manage references paket isn't already managing
  +            |> Seq.map Reference.fromXElem
  +
  +        let srcFiles =
  +            itemGroups
  +            |> Seq.collect (fun itemgroup ->
  +                XElem.descendants itemgroup
  +                |> Seq.filter (fun x -> isSrcFile x.Name.LocalName))
  +            |> Seq.map SourceFile.fromXElem
  +
  +        let proj =
  +            {   ToolsVersion      =  XElem.getAttribute "ToolsVersion" xdoc |> XAttr.value
  +                DefaultTargets    =  [XElem.getAttribute "DefaultTargets" xdoc |> XAttr.value]
  +                References        = references |> List.ofSeq
  +                Settings          = projectSettings
  +                SourceFiles       = srcFiles |> Seq.map File |> List.ofSeq
  +                ProjectReferences = projectReferences |> List.ofSeq
  +                BuildConfigs      = []
  +            }
  +
  +        proj
  +
  +    let load path =
  +        let content = System.IO.File.ReadAllText path
  +        parse content
   
   // A small abstraction over MSBuild project files.
   type ProjectFile (projectFileName:string, documentContent:string) =
  
positive.code:             CopyLocal   = XElem.tryGetElement "Private"   xelem |> Option.bind (XElem.value >> parseBool)
              Guid        = XElem.tryGetElement "Project"   xelem |> Option.bind (XElem.value >> parseGuid)
          }
          
      member self.ToXElem () =
          XElem.create "ProjectReference" []
          |> XElem.setAttribute "Include" self.Include
  
negative.code:     | None | PdbOnly | Full
  
      override self.ToString () = self |> function
          | None    -> "None"
          | PdbOnly -> "PdbOnly"
          | Full    -> "Full"
  
      static member Parse text = text |> function
          | "None"    -> DebugType.None
          | "PdbOnly" -> DebugType.PdbOnly
          | "Full"    -> DebugType.Full
          | _         -> failwithf "Could not parse '%s' into a `DebugType`" text
  
      static member TryParse text = text |> function
          | "None"    -> Some DebugType.None
          | "PdbOnly" -> Some DebugType.PdbOnly
          | "Full"    -> Some DebugType.Full
          | _         -> Option.None
  
  
  /// Determines the output of compiling the F# Project
  type OutputType =
      /// Build a console executable
      | Exe
      ///  Build a Windows executable
  