Skip to content

Instantly share code, notes, and snippets.

@orient-man
Last active August 24, 2017 12:22
Show Gist options
  • Save orient-man/9bf8390608b4218b00363c546331b509 to your computer and use it in GitHub Desktop.
Save orient-man/9bf8390608b4218b00363c546331b509 to your computer and use it in GitHub Desktop.
Appends pdb files to existing NuGet packages
module NuGetHelper
#r "../../../packages/FAKE/tools/FakeLib.dll"
#r "../../../packages/FAKE/tools/ICSharpCode.SharpZipLib.dll"
open System.IO
open Fake
let appendSymbolsToPackage outputDir configuration proj =
let fileInfo = proj |> FileInfo
let binDir = Path.Combine(fileInfo.DirectoryName, "bin/" + configuration)
let baseName = Path.GetFileNameWithoutExtension(fileInfo.Name)
let pdbFiles = !! (binDir + "/**/" + baseName + ".pdb")
let pkgFile = !! (Path.Combine(outputDir, baseName) + ".?.*.nupkg") |> Seq.last
tracefn "Appending debugging symbols to: %s" pkgFile
pdbFiles
|> Seq.iter (fun pdb ->
let fileInfo = pdb |> FileInfo
let destFile = "lib/" + fileInfo.Directory.Name + "/" + fileInfo.Name
use zipFile = new ICSharpCode.SharpZipLib.Zip.ZipFile(pkgFile)
zipFile.BeginUpdate()
zipFile.Add(pdb, destFile)
zipFile.CommitUpdate())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment