Last active
August 24, 2017 12:22
-
-
Save orient-man/9bf8390608b4218b00363c546331b509 to your computer and use it in GitHub Desktop.
Appends pdb files to existing NuGet packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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