From 4a39870d3311fabd5f8114e9c8d8da927ac55b7a Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Mon, 4 Aug 2014 16:11:09 +0200 Subject: [PATCH] NuGet: support fallback framework groups Since NuGet 2.0, dependencies and references can be specified by target framework, where only the entries from the matching group are considered. NuGet also allows defining a fallback group where the targetFramework is missing, which is used if none of the other groups match. Previously FAKE did emit the empty targetFramework attribute, which causes NuGet to complain. This change skipts the attribute if its value is null or empty, in compliance with the nuget specs. --- src/app/FakeLib/NuGet/NugetHelper.fs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/FakeLib/NuGet/NugetHelper.fs b/src/app/FakeLib/NuGet/NugetHelper.fs index 13f582f3243..28261f79b30 100644 --- a/src/app/FakeLib/NuGet/NugetHelper.fs +++ b/src/app/FakeLib/NuGet/NugetHelper.fs @@ -116,16 +116,18 @@ let private createNuspecFile parameters nuSpec = |> FullName tracefn "Creating .nuspec file at %s" specFile fi.CopyTo(specFile, true) |> ignore - let getFrameworkGroup (frameworkTags : (string * string) seq) = + + let getFrameworkGroup (frameworkTags : (string * string) seq) = frameworkTags - |> Seq.map - (fun (frameworkVersion, tags) -> sprintf "%s" frameworkVersion tags) + |> Seq.map (fun (frameworkVersion, tags) -> + if isNullOrEmpty frameworkVersion then sprintf "%s" tags + else sprintf "%s" frameworkVersion tags) |> toLines - - let getGroup items toTags = + + let getGroup items toTags = if items = [] then "" else sprintf "%s" (items |> toTags) - + let getReferencesTags references = references |> Seq.map (fun assembly -> sprintf "" assembly)