anchor.diff:              let copyLocal = defaultArg installSettings.CopyLocal true
               let importTargets = defaultArg installSettings.ImportTargets true
   
  -            this.GenerateXml(projectModel,copyLocal,importTargets,installSettings.ReferenceCondition))
  +            generateXml projectModel copyLocal importTargets installSettings.ReferenceCondition project)
           |> Seq.iter (fun (propsNodes,targetsNodes,chooseNode,propertyChooseNode, analyzersNode) ->
   
  -            let i = ref (this.ProjectNode.ChildNodes.Count-1)
  +            let i = ref (project.ProjectNode.ChildNodes.Count-1)
               while 
                 !i >= 0 && 
  -                (this.ProjectNode.ChildNodes.[!i].OuterXml.ToString().ToLower().StartsWith("<import") && 
  -                 this.ProjectNode.ChildNodes.[!i].OuterXml.ToString().ToLower().Contains("label") &&
  -                 this.ProjectNode.ChildNodes.[!i].OuterXml.ToString().ToLower().Contains("paket"))  do
  +                (project.ProjectNode.ChildNodes.[!i].OuterXml.ToString().ToLower().StartsWith "<import" && 
  +                 project.ProjectNode.ChildNodes.[!i].OuterXml.ToString().ToLower().Contains "label" &&
  +                 project.ProjectNode.ChildNodes.[!i].OuterXml.ToString().ToLower().Contains "paket")  do
                   decr i
               
               if !i <= 0 then
                   if chooseNode.ChildNodes.Count > 0 then
  -                    this.ProjectNode.AppendChild chooseNode |> ignore
  +                    project.ProjectNode.AppendChild chooseNode |> ignore
               else
  -                let node = this.ProjectNode.ChildNodes.[!i]
  +                let node = project.ProjectNode.ChildNodes.[!i]
                   if chooseNode.ChildNodes.Count > 0 then
  -                    this.ProjectNode.InsertAfter(chooseNode,node) |> ignore
  +                    project.ProjectNode.InsertAfter(chooseNode,node) |> ignore
   
               let j = ref 0
  -            while !j < this.ProjectNode.ChildNodes.Count && this.ProjectNode.ChildNodes.[!j].OuterXml.ToString().ToLower().StartsWith("<import") do
  +            while !j < project.ProjectNode.ChildNodes.Count && project.ProjectNode.ChildNodes.[!j].OuterXml.ToString().ToLower().StartsWith("<import") do
                   incr j
               
               if propertyChooseNode.ChildNodes.Count > 0 then
                   if !i <= 0 then
                       if propertyChooseNode.ChildNodes.Count > 0 then
  -                        this.ProjectNode.AppendChild propertyChooseNode |> ignore
  +                        project.ProjectNode.AppendChild propertyChooseNode |> ignore
   
                       propsNodes
  -                    |> Seq.iter (this.ProjectNode.AppendChild >> ignore)
  +                    |> Seq.iter (project.ProjectNode.AppendChild >> ignore)
                   else
  -                    let node = this.ProjectNode.ChildNodes.[!i]
  -
  +                    let node = project.ProjectNode.ChildNodes.[!i]
                       propsNodes
  -                    |> Seq.iter (fun n -> this.ProjectNode.InsertAfter(n,node) |> ignore)
  +                    |> Seq.iter (fun n -> project.ProjectNode.InsertAfter(n,node) |> ignore)
   
                       if propertyChooseNode.ChildNodes.Count > 0 then
  -                        this.ProjectNode.InsertAfter(propertyChooseNode,node) |> ignore
  +                        project.ProjectNode.InsertAfter(propertyChooseNode,node) |> ignore
  +            elif !j = 0 then
  +                    propsNodes
  +                    |> Seq.iter (project.ProjectNode.PrependChild >> ignore)
               else
  -                if !j = 0 then
  -                    propsNodes
  -                    |> Seq.iter (this.ProjectNode.PrependChild >> ignore)
  -                else
  -                    propsNodes
  -                    |> Seq.iter (fun n -> this.ProjectNode.InsertAfter(n,this.ProjectNode.ChildNodes.[!j-1]) |> ignore)
  +                propsNodes
  +                |> Seq.iter (fun n -> project.ProjectNode.InsertAfter(n,project.ProjectNode.ChildNodes.[!j-1]) |> ignore)
   
               targetsNodes
  -            |> Seq.iter (this.ProjectNode.AppendChild >> ignore)
  -
  +            |> Seq.iter (project.ProjectNode.AppendChild >> ignore)
   
               if analyzersNode.ChildNodes.Count > 0 then
  -                this.ProjectNode.AppendChild analyzersNode |> ignore
  +                project.ProjectNode.AppendChild analyzersNode |> ignore
               )
  -                
  -    member this.Save() =
  -        if Utils.normalizeXml this.Document <> this.OriginalText then 
  -            verbosefn "Project %s changed" this.FileName
  -            this.Document.Save(this.FileName)
  -
  -    member this.GetPaketFileItems() =
  -        this.FindPaketNodes("Content")
  -        |> List.append <| this.FindPaketNodes("Compile")
  -        |> List.map (fun n -> FileInfo(Path.Combine(Path.GetDirectoryName(this.FileName), n.Attributes.["Include"].Value)))
  -
  -    member this.GetProjectGuid() = 
  +
  +
  +    let save project =
  +        if Utils.normalizeXml project.Document <> project.OriginalText then 
  +            verbosefn "Project %s changed" project.FileName
  +            project.Document.Save(project.FileName)
  +
  +    let getPaketFileItems project =
  +        findPaketNodes "Content" project
  +        |> List.append <| findPaketNodes "Compile" project
  +        |> List.map (fun n -> FileInfo(Path.Combine(Path.GetDirectoryName project.FileName, n.Attributes.["Include"].Value)))
  +
  +    let getProjectGuid project = 
           try
               let forceGetInnerText node name =
                   match node |> getNode name with 
                   | Some n -> n.InnerText
                   | None -> failwithf "unable to parse %s" node.Name
   
  -            let node = this.Document |> getDescendants "PropertyGroup" |> Seq.head
  +            let node = project.Document |> getDescendants "PropertyGroup" |> Seq.head
               forceGetInnerText node "ProjectGuid" |> Guid.Parse
           with
           | _ -> Guid.Empty
   
  -    member this.GetInterProjectDependencies() =
  +    let getInterProjectDependencies project =
           let forceGetInnerText node name =
               match node |> getNode name with 
               | Some n -> n.InnerText
               | None -> failwithf "unable to parse %s" node.Name
   
  -        [for node in this.Document |> getDescendants "ProjectReference" -> 
  +        [for node in project.Document |> getDescendants "ProjectReference" -> 
               let path =
  -                    let normalizedPath = node.Attributes.["Include"].Value |> normalizePath 
  -                    if normalizedPath.Contains("$(SolutionDir)") then 
  -                        match this.GetProperty("SolutionDir") with
  -                        | Some slnDir -> normalizedPath.Replace("$(SolutionDir)",slnDir) 
  -                        | None -> normalizedPath.Replace("$(SolutionDir)", Environment.CurrentDirectory + Path.DirectorySeparatorChar.ToString())
  -                    else normalizedPath
  +                let normalizedPath = node.Attributes.["Include"].Value |> normalizePath 
  +                if normalizedPath.Contains "$(SolutionDir)" then 
  +                    match getProperty "SolutionDir" project with
  +                    | Some slnDir -> normalizedPath.Replace("$(SolutionDir)",slnDir) 
  +                    | None -> normalizedPath.Replace("$(SolutionDir)", Environment.CurrentDirectory + Path.DirectorySeparatorChar.ToString())
  +                else normalizedPath
   
               { Path =
                   if Path.IsPathRooted path then Path.GetFullPath path else 
  -                let di = FileInfo(normalizePath this.FileName).Directory
  +                let di = FileInfo(normalizePath project.FileName).Directory
                   Path.Combine(di.FullName,path) |> Path.GetFullPath
   
                 RelativePath = path.Replace("/","\\")
                 Name = forceGetInnerText node "Name"
                 GUID =  forceGetInnerText node "Project" |> Guid.Parse }]
   
  -    member this.ReplaceNuGetPackagesFile() =
  +    let replaceNuGetPackagesFile project =
           let noneAndContentNodes = 
  -            (this.Document |> getDescendants "None") @ 
  -            (this.Document |> getDescendants "Content")
  +            (project.Document |> getDescendants "None") @ 
  +            (project.Document |> getDescendants "Content")
   
           match noneAndContentNodes |> List.tryFind (withAttributeValue "Include" Constants.PackagesConfigFile) with
           | None -> ()
           | Some nugetNode ->
               match noneAndContentNodes |> List.filter (withAttributeValue "Include" Constants.ReferencesFile) with 
  -            | [_] -> nugetNode.ParentNode.RemoveChild(nugetNode) |> ignore
  +            | [_] -> nugetNode.ParentNode.RemoveChild nugetNode |> ignore
               | [] -> nugetNode.Attributes.["Include"].Value <- Constants.ReferencesFile
  -            | _::_ -> failwithf "multiple %s nodes in project file %s" Constants.ReferencesFile this.FileName
  -
  -    member this.RemoveNuGetTargetsEntries() =
  +            | _::_ -> failwithf "multiple %s nodes in project file %s" Constants.ReferencesFile project.FileName
  +
  +    let removeNuGetTargetsEntries project =
           let toDelete = 
  -            [ this.Document |> getDescendants "RestorePackages" |> List.tryHead
  -              this.Document 
  +            [ project.Document |> getDescendants "RestorePackages" |> List.tryHead
  +              project.Document 
                 |> getDescendants "Import" 
                 |> List.tryFind (fun n -> 
                       match n |> getAttribute "Project" with
                       | Some p -> p.Equals("$(SolutionDir)\\.nuget\\nuget.targets", 
                                            StringComparison.InvariantCultureIgnoreCase)
                       | None -> false)
  -              this.Document
  +              project.Document
                 |> getDescendants "Target"
                 |> List.tryFind (withAttributeValue "Name" "EnsureNuGetPackageBuildImports") ]
               |> List.choose id
  
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: 
          tryNextPlat platforms []
  
  
      let getCompileItems (this:ProjectFile) =
          let getCompileItem (compileNode : XmlNode) =
              let includePath = compileNode |> getAttribute "Include" |> fun a -> a.Value
              compileNode
  