Skip to content

Commit

Permalink
insert new generated ItemGroups for Content and Compile items before …
Browse files Browse the repository at this point in the history
…any other ItemGroup - references fsprojects#213
  • Loading branch information
theimowski committed Oct 6, 2014
1 parent d9454c5 commit c0672c7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Paket/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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<XmlNode> |> 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")

Expand Down

0 comments on commit c0672c7

Please sign in to comment.