diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 5cb2314beb..2d13d25f30 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,4 +1,4 @@
-#### 0.27.0-alpha016 - 07.02.2015
+#### 0.27.0-alpha017 - 07.02.2015
* Allow to reference `.props` and `.targets` files - https://github.com/fsprojects/Paket/issues/516
* Create a install function in the api which takes a `paket.dependencies` file as text - https://github.com/fsprojects/Paket/issues/576
* Don't internalize in paket.exe during ILMerge
diff --git a/src/Paket.Core/ProjectFile.fs b/src/Paket.Core/ProjectFile.fs
index fe6cbcf392..c0e5fa7e7a 100644
--- a/src/Paket.Core/ProjectFile.fs
+++ b/src/Paket.Core/ProjectFile.fs
@@ -261,7 +261,7 @@ type ProjectFile =
node
|> propertyGroup.AppendChild
|> ignore
- Some(propertyName,path.Substring(0,path.LastIndexOf("build\\") + 6)))
+ Some(propertyName,path,path.Substring(0,path.LastIndexOf("build\\") + 6)))
|> Set.ofSeq
propertyNames,propertyGroup
@@ -301,7 +301,7 @@ type ProjectFile =
let propertyNames,propertyChooseNode =
match targetsFileConditions with
| ["$(TargetFrameworkIdentifier) == 'true'",(propertyNames,propertyGroup)] ->
- [propertyNames],propertyGroup
+ [propertyNames],this.CreateNode("Choose")
| _ ->
let propertyChooseNode = this.CreateNode("Choose")
@@ -323,13 +323,18 @@ type ProjectFile =
let propertyNameNodes =
propertyNames
- |> Set.unionMany
- |> Seq.map (fun (propertyName,buildPath) ->
+ |> Seq.concat
+ |> Seq.distinctBy (fun (x,_,_) -> x)
+ |> Seq.map (fun (propertyName,path,buildPath) ->
let fileName =
- if propertyName.ToLower().EndsWith "props" then
+ match propertyName.ToLower() with
+ | _ when propertyChooseNode.ChildNodes.Count = 0 -> path
+ | name when name.EndsWith "props" ->
sprintf "%s$(%s).props" buildPath propertyName
- else
- sprintf "%s$(%s).targets" buildPath propertyName
+ | name when name.EndsWith "targets" ->
+ sprintf "%s$(%s).targets" buildPath propertyName
+ | _ -> failwithf "Unknown .targets filename %s" propertyName
+
this.CreateNode("Import")
|> addAttribute "Project" fileName
|> addAttribute "Condition" (sprintf "Exists('%s')" fileName))
diff --git a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs
index 341e799b2b..cae5430eb8 100644
--- a/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs
+++ b/tests/Paket.Tests/InstallModel/Xml/GitInfoPlanter.fs
@@ -10,13 +10,11 @@ open Paket.Requirements
let emptyReferences = """
"""
-let expectedPropertyDefinitionNodes = """
-
- <__paket__GitInfoPlanter_targets>GitInfoPlanter
-"""
+let emptyPropertyDefinitionNodes = """
+"""
let expectedPropertyNodes = """
-"""
+"""
[]
let ``should generate Xml for GitInfoPlanter2.0.0``() =
@@ -33,7 +31,7 @@ let ``should generate Xml for GitInfoPlanter2.0.0``() =
propertyChooseNode.OuterXml
|> normalizeXml
- |> shouldEqual (normalizeXml expectedPropertyDefinitionNodes)
+ |> shouldEqual (normalizeXml emptyPropertyDefinitionNodes)
propertyNodes |> Seq.length |> shouldEqual 1
diff --git a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs
index fbcc060318..3ad4178227 100644
--- a/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs
+++ b/tests/Paket.Tests/InstallModel/Xml/StyleCop.MSBuild.fs
@@ -7,13 +7,11 @@ open Paket.TestHelpers
open Paket.Domain
open Paket.Requirements
-let expected = """
-
- <__paket__StyleCop_MSBuild_Targets>StyleCop.MSBuild
-"""
+let emptyPropertyNameNodes = """
+"""
let expectedPropertyNodes = """
-"""
+"""
[]
let ``should generate Xml for StyleCop.MSBuild``() =
@@ -28,7 +26,7 @@ let ``should generate Xml for StyleCop.MSBuild``() =
propertyChooseNode.OuterXml
|> normalizeXml
- |> shouldEqual (normalizeXml expected)
+ |> shouldEqual (normalizeXml emptyPropertyNameNodes)
propertyNodes |> Seq.length |> shouldEqual 1