TaskItem source = new TaskItem("path/to/source/file.ext"); source.SetMetadata("destinationFolder", "path/to/destination/folder"); TaskItem destination = new TaskItem("path/to/destination/file.ext"); destination.SetMetadata("destinationFolder", "path/to/destination/folder");
var filesToZip = new ListThe package library for Microsoft.Build.Utilities can be found in the Microsoft.Build.Utilities.Core nuget package.{ new TaskItem("path/to/file1.ext"), new TaskItem("path/to/file2.ext"), new TaskItem("path/to/file3.ext") }; Zip zipTask = new Zip(); zipTask.FilesToCompress = filesToZip.ToArray(); zipTask.OutputFilePath = "path/to/output/archive.zip"; zipTask.Execute();