anchor.diff:  let header = ReadFile(__SOURCE_DIRECTORY__ @@ "build.fsx") |> Seq.take 10 |> Seq.map (fun s -> s.Substring(2)) |> toLines
   trace header
   
  -Target "Start" DoNothing
  -Target "Clean" (fun _ ->
  -    CleanDirs [ "obj" ]
  -    CleanDirs [ "out/api"; "out/docs"; "out/packages" ]
  -    CleanDirs [ "out/lib/Net35"; "out/lib/Net40"; "out/lib/Profile47"; "out/lib/Profile344" ]
  -    CleanDirs [ "out/test/Net35"; "out/test/Net40"; "out/test/Profile47"; "out/test/Profile344" ]
  -    CleanDirs [ "out/lib-signed/Net40" ]
  -    CleanDirs [ "out/test-signed/Net40" ])
  -Target "RestorePackages" RestorePackages
  -Target "Prepare" DoNothing
  -
  -"Start"
  -  =?> ("Clean", not (hasBuildParam "incremental"))
  -  ==> "RestorePackages"
  -  ==> "Prepare"
  -
  -
  -// ======================================================================================
  -// Math.NET Numerics Core
  -// ======================================================================================
  -
  +
  +// --------------------------------------------------------------------------------------
   // PROJECT INFO
  +// --------------------------------------------------------------------------------------
  +
  +// CORE PACKAGES
   
   type Package =
       { Id: string
  
positive.code:                                 @"..\..\src\FSharp\**\*.fs", Some "src/Common", None ] }
  
  
  // APPLY VERSION
  
  Target "AssemblyInfo" (fun _ ->
      BulkReplaceAssemblyInfoVersions "src/" (fun f ->
          { f with
              AssemblyVersion = assemblyVersion
              AssemblyFileVersion = assemblyVersion
              AssemblyInformationalVersion = packageVersion }))
  
  "Prepare" ==> "AssemblyInfo"
  
  
  // BUILD
  
  let buildConfig config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [ "Configuration", config ] subject |> ignore
  let build subject = buildConfig "Release" subject
  let buildSigned subject = buildConfig "Release-Signed" subject
  
  Target "BuildMain" (fun _ -> build !! "MathNet.Numerics.sln")
  Target "BuildNet35" (fun _ -> build !! "MathNet.Numerics.Net35Only.sln")
  Target "BuildAll" (fun _ -> build !! "MathNet.Numerics.All.sln")
  Target "BuildSigned" (fun _ -> buildSigned !! "MathNet.Numerics.sln")
  
  Target "Build" DoNothing
  "Prepare"
    ==> "AssemblyInfo"
    =?> ("BuildNet35", hasBuildParam "net35")
    =?> ("BuildSigned", hasBuildParam "signed" || hasBuildParam "release")
    =?> ("BuildAll", hasBuildParam "all" || hasBuildParam "release")
    =?> ("BuildMain", not (hasBuildParam "all" || hasBuildParam "release" || hasBuildParam "net35" || hasBuildParam "signed"))
    ==> "Build"
  
  
  // TEST
  
  let test target =
      let quick p = if hasBuildParam "quick" then { p with ExcludeCategory="LongRunning" } else p
      NUnit (fun p ->
          { p with
              DisableShadowCopy = true
              TimeOut = TimeSpan.FromMinutes 30.
              OutputFile = "TestResults.xml" } |> quick) target
  
  Target "Test" (fun _ -> test !! "out/test/**/*UnitTests*.dll")
  "Build" ==> "Test"
  
  
  // ZIP
  
  let provideLicenseReadme license releasenotes path =
      let licensePath = path @@ "license.txt"
      let readmePath = path @@ "readme.txt"
      CopyFile licensePath license
      CopyFile readmePath releasenotes
      ConvertFileToWindowsLineBreaks licensePath
      header + Environment.NewLine + (ReadFileAsString readmePath)
      |> ConvertTextToWindowsLineBreaks 
      |> ReplaceFile readmePath
  
  Target "Zip" (fun _ ->
      CleanDir "out/packages/Zip"
      CleanDir "obj/Zip"
      if not (hasBuildParam "signed") || hasBuildParam "release" then
          CopyDir "obj/Zip/MathNet.Numerics" "out/lib" (fun f -> f.Contains("MathNet.Numerics."))
          provideLicenseReadme "LICENSE.md" "RELEASENOTES.md" "obj/Zip/MathNet.Numerics"
          Zip "obj/Zip/" (sprintf "out/packages/Zip/MathNet.Numerics-%s.zip" packageVersion) !! "obj/Zip/MathNet.Numerics/**/*.*"
      if hasBuildParam "signed" || hasBuildParam "release" then
          CopyDir "obj/Zip/MathNet.Numerics.Signed" "out/lib-signed" (fun f -> f.Contains("MathNet.Numerics."))
          provideLicenseReadme "LICENSE.md" "RELEASENOTES.md" "obj/Zip/MathNet.Numerics.Signed"
          Zip "obj/Zip/" (sprintf "out/packages/Zip/MathNet.Numerics.Signed-%s.zip" packageVersion) !! "obj/Zip/MathNet.Numerics.Signed/**/*.*"
      CleanDir "obj/Zip")
  
  "Build" ==> "Zip"
  
  
  // NUGET
  
  let updateNuspec pack outPath symbols updateFiles spec =
      { spec with ToolPath = "tools/NuGet/NuGet.exe"
                  OutputPath = outPath
                  WorkingDir = "obj/NuGet"
                  Version = pack.Version
                  ReleaseNotes = pack.ReleaseNotes
                  Project = pack.Id
                  Title = pack.Title
                  Summary = pack.Summary
                  Description = pack.Description
                  Tags = pack.Tags
                  Authors = pack.Authors
                  Dependencies = pack.Dependencies
                  SymbolPackage = symbols
                  Files = updateFiles pack.Files
                  Publish = false }
  
  let nugetPack pack outPath =
      CleanDir "obj/NuGet"
      provideLicenseReadme "LICENSE.md" "RELEASENOTES.md" "obj/NuGet"
      let withLicenseReadme f = [ "license.txt", None, None; "readme.txt", None, None; ] @ f
      let withoutSymbolsSources f =
          List.choose (function | (_, Some (target:string), _) when target.StartsWith("src") -> None
                                | (s, t, None) -> Some (s, t, Some ("**/*.pdb"))
                                | (s, t, Some e) -> Some (s, t, Some (e + ";**/*.pdb"))) f
      NuGet (updateNuspec pack outPath NugetSymbolPackage.Nuspec withLicenseReadme) "build/MathNet.Numerics.nuspec"
      NuGet (updateNuspec pack outPath NugetSymbolPackage.None (withLicenseReadme >> withoutSymbolsSources)) "build/MathNet.Numerics.nuspec"
      CleanDir "obj/NuGet"
  
  Target "NuGet" (fun _ ->
      let outPath = "out/packages/NuGet"
      CleanDir outPath
      if hasBuildParam "signed" || hasBuildParam "release" then
          nugetPack numericsSignedPack outPath
          nugetPack fsharpSignedPack outPath
      if hasBuildParam "all" || hasBuildParam "release" then
          nugetPack numericsPack outPath
          nugetPack fsharpPack outPath
      CleanDir "obj/NuGet")
  
  "Build" ==> "NuGet"
  
  
  // ======================================================================================
  // Math.NET Numerics Native Providers
  // Requires a local installation of Intel MKL
  // ======================================================================================
  
  // PROJECT INFO
  
  let nativeRelease = LoadReleaseNotes "RELEASENOTES-Native.md"
  let nativeBuildPart = "0"
  
negative.code:                                         @"..\..\out\MKL\Windows\x64\MathNet.Numerics.MKL.dll", Some "content", None ] }
  
  
  // --------------------------------------------------------------------------------------
  // PREPARE
  // --------------------------------------------------------------------------------------
  
  Target "Start" DoNothing
  
  Target "Clean" (fun _ ->
      CleanDirs [ "obj" ]
      CleanDirs [ "out/api"; "out/docs"; "out/packages" ]
      CleanDirs [ "out/lib/Net35"; "out/lib/Net40"; "out/lib/Profile47"; "out/lib/Profile344" ]
      CleanDirs [ "out/test/Net35"; "out/test/Net40"; "out/test/Profile47"; "out/test/Profile344" ]
      CleanDirs [ "out/lib-signed/Net40" ]
      CleanDirs [ "out/test-signed/Net40" ])
  
  Target "NativeClean" (fun _ -> CleanDirs [ "out/MKL"; "out/ATLAS" ] )
  
  Target "RestorePackages" RestorePackages
  
  Target "ApplyVersion" (fun _ ->
      BulkReplaceAssemblyInfoVersions "src/" (fun f ->
          { f with
              AssemblyVersion = assemblyVersion
              AssemblyFileVersion = assemblyVersion
              AssemblyInformationalVersion = packageVersion })
      ReplaceInFile
          (regex_replace "\d+\.\d+\.\d+\.\d+" nativeAssemblyVersion
           >> regex_replace "\d+,\d+,\d+,\d+" (replace "." "," nativeAssemblyVersion))
          "src/NativeProviders/Common/resource.rc")
  
  Target "Prepare" DoNothing
  "Start"
    =?> ("Clean", not (hasBuildParam "incremental"))
    ==> "RestorePackages"
    ==> "ApplyVersion"
    ==> "Prepare"
  
  
  // --------------------------------------------------------------------------------------
  // BUILD
  // --------------------------------------------------------------------------------------
  
  let buildConfig config subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [ "Configuration", config ] subject |> ignore
  let build subject = buildConfig "Release" subject
  let buildSigned subject = buildConfig "Release-Signed" subject
  let native32Build subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [("Configuration","Release"); ("Platform","Win32")] subject |> ignore
  let native64Build subject = MSBuild "" (if hasBuildParam "incremental" then "Build" else "Rebuild") [("Configuration","Release"); ("Platform","x64")] subject |> ignore
  
  Target "BuildMain" (fun _ -> build !! "MathNet.Numerics.sln")
  Target "BuildNet35" (fun _ -> build !! "MathNet.Numerics.Net35Only.sln")
  Target "BuildAll" (fun _ -> build !! "MathNet.Numerics.All.sln")
  Target "BuildSigned" (fun _ -> buildSigned !! "MathNet.Numerics.sln")
  
  Target "Build" DoNothing
  "Prepare"
    =?> ("BuildNet35", hasBuildParam "net35")
    =?> ("BuildSigned", hasBuildParam "signed" || hasBuildParam "release")
    =?> ("BuildAll", hasBuildParam "all" || hasBuildParam "release")
    =?> ("BuildMain", not (hasBuildParam "all" || hasBuildParam "release" || hasBuildParam "net35" || hasBuildParam "signed"))
    ==> "Build"
  
  Target "Native32Build" (fun _ -> native32Build !! "MathNet.Numerics.NativeProviders.sln")
  Target "Native64Build" (fun _ -> native64Build !! "MathNet.Numerics.NativeProviders.sln")
  
  Target "NativeBuild" DoNothing
  "Prepare"
    =?> ("NativeClean", not (hasBuildParam "incremental"))
    ==> "Native32Build"
    ==> "NativeBuild"
  "Prepare"
  