Search code examples
c#cakebuild

How to use exclude pattern(.pdb,.xml) while zip the directory files in cake?


I want to exclude some format files like PDB, XML and BMP files in my zip package.

Please help me on this http://cakebuild.net/api/Cake.Common.IO/ZipAliases/B6C83EAE.


Solution

  • Note the built in Zip aliases will only create a standard Zip file not 7zip, if it's only assemblies you want to include in your archive you can use the Zip(DirectoryPath rootPath, FilePath outputPath, string pattern) overload.

    Example usage:

     Zip("./", "dllfiles.zip", "./*.dll");
    

    If you have several different file types, then I would recommend you create a directory with the artifacts you want to archive and then just zip that directory.