diff --git a/src/Paket.Core/PaketConfigFiles/ProjectFile.fs b/src/Paket.Core/PaketConfigFiles/ProjectFile.fs
index b1bbd2ea3f..4d9a17dc32 100644
--- a/src/Paket.Core/PaketConfigFiles/ProjectFile.fs
+++ b/src/Paket.Core/PaketConfigFiles/ProjectFile.fs
@@ -993,6 +993,10 @@ module ProjectFile =
let getTargetFrameworkIdentifier (project:ProjectFile) = getProperty "TargetFrameworkIdentifier" project
let getTargetFrameworkProfile (project:ProjectFile) = getProperty "TargetFrameworkProfile" project
+ let getTargetFrameworkVersion (project:ProjectFile) = getProperty "TargetFrameworkVersion" project
+ let getTargetFramework (project:ProjectFile) = getProperty "TargetFramework" project
+ let getTargetFrameworks (project:ProjectFile) = getProperty "TargetFrameworks" project
+
let getTargetProfile (project:ProjectFile) =
let fallback () =
@@ -1000,12 +1004,15 @@ module ProjectFile =
match getTargetFrameworkIdentifier project with
| None -> "net"
| Some x -> x
- let framework = getProperty "TargetFrameworkVersion" project
+ let framework =
+ match getTargetFrameworkVersion project with
+ | None -> getTargetFramework project
+ | Some x -> Some(prefix + x.Replace("v",""))
let defaultResult = SinglePlatform (DotNetFramework FrameworkVersion.V4)
match framework with
| None -> defaultResult
| Some s ->
- match FrameworkDetection.Extract(prefix + s.Replace("v","")) with
+ match FrameworkDetection.Extract(s) with
| None -> defaultResult
| Some x -> SinglePlatform x
@@ -1432,6 +1439,11 @@ module ProjectFile =
sprintf "%s.%s" assemblyName ending
let getOutputDirectory buildConfiguration buildPlatform (project:ProjectFile) =
+ let targetFramework =
+ match getTargetFramework project with
+ | Some x -> x
+ | None -> ""
+
let platforms =
if not <| String.IsNullOrWhiteSpace buildPlatform then
[buildPlatform]
@@ -1449,12 +1461,14 @@ module ProjectFile =
let rec tryNextPlat platforms attempted =
match platforms with
| [] ->
- if String.IsNullOrWhiteSpace(buildPlatform) then
+ if String.IsNullOrEmpty(targetFramework) = false then
+ Path.Combine("bin", buildConfiguration, targetFramework)
+ else if String.IsNullOrWhiteSpace(buildPlatform) then
failwithf "Unable to find %s output path node in file %s for any known platforms" buildConfiguration project.FileName
else
failwithf "Unable to find %s output path node in file %s targeting the %s platform" buildConfiguration project.FileName buildPlatform
| x::xs ->
- let startingData = Map.ofList [("Configuration", buildConfiguration); ("Platform", x)]
+ let startingData = Map.ofList [("Configuration", buildConfiguration); ("TargetFramework", targetFramework);("Platform", x)]
[getPropertyWithDefaults "OutputPath" startingData project; getPropertyWithDefaults "OutDir" startingData project]
|> List.choose id
|> function
@@ -1463,7 +1477,7 @@ module ProjectFile =
if String.IsNullOrWhiteSpace buildPlatform && attempted <> [] then
let tested = String.Join(", ", attempted)
traceWarnfn "No platform specified; found output path node for the %s platform after failing to find one for the following: %s" x tested
- s.TrimEnd [|'\\'|] |> normalizePath
+ Path.Combine(s.TrimEnd [|'\\'|] , targetFramework) |> normalizePath
tryNextPlat platforms []
diff --git a/tests/Paket.Tests/Paket.Tests.fsproj b/tests/Paket.Tests/Paket.Tests.fsproj
index fa4afa7903..b07699906a 100644
--- a/tests/Paket.Tests/Paket.Tests.fsproj
+++ b/tests/Paket.Tests/Paket.Tests.fsproj
@@ -208,8 +208,8 @@
-
- PreserveNewest
+
+ Always
PreserveNewest
@@ -275,6 +275,12 @@
Always
+
+ PreserveNewest
+
+
+ Always
+
diff --git a/tests/Paket.Tests/ProjectFile/OutputSpecs.fs b/tests/Paket.Tests/ProjectFile/OutputSpecs.fs
index 555d56994f..91e8ecabd7 100644
--- a/tests/Paket.Tests/ProjectFile/OutputSpecs.fs
+++ b/tests/Paket.Tests/ProjectFile/OutputSpecs.fs
@@ -47,6 +47,29 @@ let ``should detect output path for proj file``
let expected = (System.IO.Path.Combine(@"bin", configuration) |> normalizePath)
outPath.ToLowerInvariant() |> shouldEqual (expected.ToLowerInvariant())
+[]
+let ``should detect output path for netsdk csproj file``
+ ([] project)
+ ([] configuration) =
+ ensureDir ()
+ let projectFile = ProjectFile.TryLoad(sprintf "./ProjectFile/TestData/%s" project).Value
+ let target = projectFile.GetTargetProfile().ToString()
+ let outPath = projectFile.GetOutputDirectory configuration ""
+ let expected = (System.IO.Path.Combine(@"bin", configuration, target) |> normalizePath)
+ outPath.ToLowerInvariant() |> shouldEqual (expected.ToLowerInvariant())
+
+[]
+let ``should detect output path for netsdk with outputPath csproj file``
+ ([] project)
+ ([] configuration) =
+ ensureDir ()
+ let projectFile = ProjectFile.TryLoad(sprintf "./ProjectFile/TestData/%s" project).Value
+ let target = projectFile.GetTargetProfile().ToString()
+ let outPath = projectFile.GetOutputDirectory configuration ""
+ let expected = (System.IO.Path.Combine(@"bin", configuration,"netstandard1.4_bin", target) |> normalizePath)
+ outPath.ToLowerInvariant() |> shouldEqual (expected.ToLowerInvariant())
+
+
[]
let ``should detect framework profile for ProjectWithConditions file`` () =
ensureDir ()
diff --git a/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs b/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs
index 8d8e070229..d13f590984 100644
--- a/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs
+++ b/tests/Paket.Tests/ProjectFile/TargetFrameworkSpecs.fs
@@ -29,6 +29,10 @@ let TestData: obj[][] =
portable;
"portable-net45+win8+wp8+wpa81";
(DotNetFramework FrameworkVersion.V4_5)|];
+ [|"MicrosoftNetSdkWithTargetFramework.csprojtest";
+ (SinglePlatform(DotNetStandard DotNetStandardVersion.V1_4));
+ "netstandard1.4";
+ (DotNetStandard DotNetStandardVersion.V1_4)|];
|]
[]
diff --git a/tests/Paket.Tests/ProjectFile/TestData/MicrosoftNetSdkWithTargetFramework.csprojtest b/tests/Paket.Tests/ProjectFile/TestData/MicrosoftNetSdkWithTargetFramework.csprojtest
new file mode 100644
index 0000000000..afbc4f2e17
--- /dev/null
+++ b/tests/Paket.Tests/ProjectFile/TestData/MicrosoftNetSdkWithTargetFramework.csprojtest
@@ -0,0 +1,7 @@
+
+
+
+ TestPaket
+ netstandard1.4
+
+
\ No newline at end of file
diff --git a/tests/Paket.Tests/ProjectFile/TestData/MicrosoftNetSdkWithTargetFrameworkAndOutputPath.csprojtest b/tests/Paket.Tests/ProjectFile/TestData/MicrosoftNetSdkWithTargetFrameworkAndOutputPath.csprojtest
new file mode 100644
index 0000000000..244e0fd286
--- /dev/null
+++ b/tests/Paket.Tests/ProjectFile/TestData/MicrosoftNetSdkWithTargetFrameworkAndOutputPath.csprojtest
@@ -0,0 +1,11 @@
+
+
+
+ TestPaket
+ netstandard1.4
+
+
+
+ bin\Release\netstandard1.4_bin\
+
+
\ No newline at end of file