From c0672c7dd4af50c4ddc8aa4ec77bf92f4526de3c Mon Sep 17 00:00:00 2001 From: Tomasz Heimowski Date: Mon, 6 Oct 2014 12:55:43 +0200 Subject: [PATCH] insert new generated ItemGroups for Content and Compile items before any other ItemGroup - references #213 --- src/Paket/ProjectFile.fs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Paket/ProjectFile.fs b/src/Paket/ProjectFile.fs index f0e11b470a..78cfb671cc 100644 --- a/src/Paket/ProjectFile.fs +++ b/src/Paket/ProjectFile.fs @@ -189,9 +189,13 @@ type ProjectFile = | None -> let firstNode = fileItemsInSameDir |> Seq.head firstNode.ParentNode.InsertBefore(paketNode, firstNode) |> ignore - + + let firstItemGroup = this.Document.SelectNodes("//ns:ItemGroup", this.Namespaces) |> Seq.cast |> Seq.firstOrDefault for newItemGroup in newItemGroups.Values do - if newItemGroup.HasChildNodes then this.ProjectNode.AppendChild(newItemGroup) |> ignore + if newItemGroup.HasChildNodes then + match firstItemGroup with + | Some firstItemGroup -> firstItemGroup.ParentNode.InsertBefore(newItemGroup, firstItemGroup) |> ignore + | None -> this.ProjectNode.AppendChild(newItemGroup) |> ignore this.DeleteIfEmpty("//ns:ItemGroup")