anchor.diff:          this.Document
           |> getDescendants "Compile"
           |> Seq.map getCompileItem
  -
  -    static member LoadFromStream(fullName:string, stream:Stream) =
  -        let doc = new XmlDocument()
  -        doc.Load stream
  -
  -        let manager = new XmlNamespaceManager(doc.NameTable)
  -        manager.AddNamespace("ns", Constants.ProjectDefaultNameSpace)
  -        let projectNode = 
  -            match doc |> getNode "Project" with
  -            | Some node -> node
  -            | _ -> failwithf "unable to find Project node in file %s" fullName
  -        { 
  -            FileName = fullName
  -            Document = doc
  -            ProjectNode = projectNode
  -            OriginalText = Utils.normalizeXml doc
  -            Language = LanguageEvaluation.getProjectLanguage doc (Path.GetFileName(fullName)) }
  -
  -    static member LoadFromFile(fileName:string) =
  -        let fileInfo = FileInfo (normalizePath fileName)
  -        use stream = fileInfo.OpenRead()
  -        ProjectFile.LoadFromStream(fileInfo.FullName, stream)
  -
  -    static member TryLoad(fileName:string) =
  -        try
  -            Some(ProjectFile.LoadFromFile(fileName))
  -        with
  -        | exn -> 
  -            traceWarnfn "Unable to parse %s:%s      %s" fileName Environment.NewLine exn.Message
  -            None
  -
  -
  -    static member TryFindProject(projects: ProjectFile seq,projectName) =
  -        match projects |> Seq.tryFind (fun p -> p.NameWithoutExtension = projectName || p.Name = projectName) with
  -        | Some p -> Some p
  -        | None ->
  -            try
  -                let fi = FileInfo (normalizePath (projectName.Trim().Trim([|'\"'|]))) // check if we can detect the path
  -                let rec checkDir (dir:DirectoryInfo) = 
  -                    match projects |> Seq.tryFind (fun p -> (FileInfo p.FileName).Directory.ToString().ToLower() = dir.ToString().ToLower()) with
  -                    | Some p -> Some p
  -                    | None ->
  -                        if isNull dir.Parent then None else
  -                        checkDir dir.Parent
  -
  -                checkDir fi.Directory
  -            with
  -            | _ -> None
  +    
  +
  +type ProjectFile with
  +
  +    member this.GetPropertyWithDefaults propertyName defaultProperties = ProjectFile.getPropertyWithDefaults propertyName defaultProperties this
  +
  +    member this.GetProperty propertyName =  ProjectFile.getProperty propertyName this
  +
  +    member this.Name = ProjectFile.name this
  +
  +    member this.NameWithoutExtension = ProjectFile.nameWithoutExtension this
  +
  +    member this.GetCustomReferenceAndFrameworkNodes() = ProjectFile.getCustomReferenceAndFrameworkNodes this
  +
  +    /// Finds all project files
  +    static member FindAllProjects folder =  ProjectFile.findAllProjects folder
  +
  +    static member FindCorrespondingFile (projectInfo, correspondingFile) = ProjectFile.findCorrespondingFile projectInfo correspondingFile
  +
  +    static member FindReferencesFile (projectInfo : FileInfo) = ProjectFile.findReferencesFile projectInfo 
  +
  +    static member FindTemplatesFile (projectInfo : FileInfo) = ProjectFile.findTemplatesFile projectInfo 
  +
  +    static member FindOrCreateReferencesFile (projectInfo : FileInfo) = ProjectFile.findOrCreateReferencesFile projectInfo
  +
  +    member this.CreateNode name =   ProjectFile.createNode name this
  +
  +    member this.CreateNode(name, text) = ProjectFile.createNodeSet name text this
  +
  +    member this.HasPackageInstalled (groupName,package:PackageName) = ProjectFile.hasPackageInstalled groupName package this
  +
  +    member this.DeleteIfEmpty name = ProjectFile.deleteIfEmpty name this
  +
  +    member this.FindPaketNodes name = ProjectFile.findPaketNodes name this
  +
  +    member this.GetFrameworkAssemblies() =  ProjectFile.getFrameworkAssemblies this
  +
  +    member this.DeletePaketNodes name = ProjectFile.deletePaketNodes name this
  +    
  +    member this.UpdateFileItems(fileItems : FileItem list, hard) = ProjectFile.updateFileItems fileItems hard this
  +
  +    member this.GetCustomModelNodes(model:InstallModel) = ProjectFile.getCustomModelNodes model this
  +
  +    member this.DeleteCustomModelNodes(model:InstallModel) = ProjectFile.deleteCustomModelNodes model this
  +
  +    member this.GenerateXml(model, copyLocal, importTargets, referenceCondition) = ProjectFile.generateXml model copyLocal importTargets referenceCondition this
  +
  +    member this.RemovePaketNodes () = ProjectFile.removePaketNodes this 
  +
  +    member this.UpdateReferences (completeModel, usedPackages, hard) = ProjectFile.updateReferences completeModel usedPackages hard this
  +         
  +    member this.Save () = ProjectFile.save this
  +
  +    member this.GetPaketFileItems () = ProjectFile.getPaketFileItems this
  +
  +    member this.GetProjectGuid () = ProjectFile.getProjectGuid this
  +
  +    member this.GetInterProjectDependencies () =  ProjectFile.getInterProjectDependencies this
  +
  +    member this.ReplaceNuGetPackagesFile () = ProjectFile.removeNuGetTargetsEntries this
  +
  +    member this.RemoveNuGetTargetsEntries () =  ProjectFile.removeNuGetTargetsEntries this
  +
  +    member this.RemoveImportAndTargetEntries (packages : list<string * SemVerInfo> ) =  ProjectFile.removeImportAndTargetEntries packages this
  +
  +    member this.OutputType =  ProjectFile.outputType this
  +
  +    member this.GetTargetFrameworkIdentifier () =  ProjectFile.getTargetFrameworkIdentifier this
  +
  +    member this.GetTargetFrameworkProfile () = ProjectFile.getTargetFrameworkProfile this
  +
  +    member this.GetTargetProfile () =  ProjectFile.getTargetProfile this
  +    
  +    member this.AddImportForPaketTargets relativeTargetsPath = ProjectFile.addImportForPaketTargets relativeTargetsPath this
  +
  +    member this.RemoveImportForPaketTargets relativeTargetsPath =  ProjectFile.removeImportForPaketTargets relativeTargetsPath this
  +
  +    member this.DetermineBuildAction fileName = ProjectFile.determineBuildAction fileName this
  +
  +    member this.DetermineBuildActionForRemoteItems fileName = ProjectFile.determineBuildActionForRemoteItems fileName this
  +
  +    member this.GetOutputDirectory buildConfiguration buildPlatform =  ProjectFile.getOutputDirectory buildConfiguration buildPlatform this
  +
  +    member this.GetAssemblyName () = ProjectFile.getAssemblyName this
  +
  +    member this.GetCompileItems () =  ProjectFile.getCompileItems this
  +
  +    static member LoadFromStream(fullName:string, stream:Stream) = ProjectFile.loadFromStream fullName stream 
  +
  +    static member LoadFromFile(fileName:string) =  ProjectFile.loadFromFile fileName
  +
  +    static member TryLoad(fileName:string) = ProjectFile.tryLoad fileName
  +
  +    static member TryFindProject(projects: ProjectFile seq,projectName) = ProjectFile.tryFindProject projects projectName
  
positive.code:                     Path.Combine(projectFile.Directory.FullName,projectFile.Name + "." + Constants.ReferencesFile)
                  else
                      fi.FullName
  
              ReferencesFile.New newFileName
          | Some fileName -> ReferencesFile.FromFile fileName
  
      member this.CreateNode(name) = 
          this.Document.CreateElement(name, Constants.ProjectDefaultNameSpace)
  
      member this.HasPackageInstalled(groupName,package:PackageName) = 
          let proj = FileInfo(this.FileName)
          match ProjectFile.FindReferencesFile proj with
          | None -> false
          | Some fileName -> 
              let referencesFile = ReferencesFile.FromFile fileName
              referencesFile.Groups.[groupName].NugetPackages 
              |> Seq.exists (fun p -> p.Name = package)
  
      member this.CreateNode(name, text) = 
          let node = this.CreateNode(name)
          node.InnerText <- text
          node
  
      member this.DeleteIfEmpty name =
          let nodesToDelete = List<_>()
          for node in this.Document |> getDescendants name do
              if node.ChildNodes.Count = 0 then
                  nodesToDelete.Add node
  
          for node in nodesToDelete do
              node.ParentNode.RemoveChild(node) |> ignore
  
          Seq.isEmpty nodesToDelete |> not
  
      member this.FindPaketNodes(name) = this.FindNodes true name
  
      member this.GetFrameworkAssemblies() = 
          [for node in this.Document |> getDescendants "Reference" do
              let hasHintPath = ref false
              for child in node.ChildNodes do
                  if child.Name = "HintPath" then 
  
negative.code:                     if hard 
                      then 
                          if not <| (existingNode.ChildNodes |> Seq.cast<XmlNode> |> Seq.exists (fun n -> n.Name = "Paket"))
                          then existingNode :?> XmlElement |> addChild (createNodeSet "Paket" "True" project) |> ignore
                      else verbosefn "  - custom nodes for %s in %s ==> skipping" fileItem.Include project.FileName
                  | None  ->
                      let firstNode = fileItemsInSameDir |> Seq.head 
                      firstNode.ParentNode.InsertBefore(libReferenceNode, firstNode) |> ignore
          
          let paketNodes = 
              (findPaketNodes "Compile" project)
              @ (findPaketNodes "Content" project)
             
          // remove unneeded files
          for paketNode in paketNodes do
              match getAttribute "Include" paketNode with
              | Some path ->
                  if not (fileItems |> List.exists (fun fi -> fi.Include = path)) then 
                    paketNode.ParentNode.RemoveChild paketNode |> ignore
              | _ -> ()
  
          deleteIfEmpty "PropertyGroup" project |> ignore
          deleteIfEmpty "ItemGroup"     project |> ignore
          deleteIfEmpty "When"          project |> ignore
          deleteIfEmpty "Choose"        project |> ignore
  
      let getCustomModelNodes(model:InstallModel) (project:ProjectFile)  =
          let libs =
              model.GetLibReferencesLazy.Force()
              |> Set.map (fun lib -> lib.ReferenceName)
         
          getCustomReferenceAndFrameworkNodes project
          |> List.filter (fun node -> 
              let libName = node.Attributes.["Include"].InnerText.Split(',').[0]
              Set.contains libName libs)
  
      let deleteCustomModelNodes (model:InstallModel) (project:ProjectFile) =
          let nodesToDelete = 
              getCustomModelNodes model project
              |> List.filter (fun node ->
                  let isFrameworkNode = ref true
                  for child in node.ChildNodes do
  