public void Execute() { int payloadCount = this.Payloads.Count(); // The number of embedded payloads if (!String.IsNullOrEmpty(this.ManifestFile)) { ++payloadCount; } using (var cab = new WixCreateCab(Path.GetFileName(this.OutputPath), Path.GetDirectoryName(this.OutputPath), payloadCount, 0, 0, this.DefaultCompressionLevel)) { // If a manifest was provided always add it as "payload 0" to the container. if (!String.IsNullOrEmpty(this.ManifestFile)) { cab.AddFile(this.ManifestFile, "0"); } foreach (WixBundlePayloadRow payload in this.Payloads) { Debug.Assert(PackagingType.Embedded == payload.Packaging); Messaging.Instance.OnMessage(WixVerboses.LoadingPayload(payload.FullFileName)); cab.AddFile(payload.FullFileName, payload.EmbeddedId); } cab.Complete(); } // Now that the container is created, set the outputs of the command. FileInfo fileInfo = new FileInfo(this.OutputPath); this.Hash = Common.GetFileHash(fileInfo.FullName); this.Size = fileInfo.Length; }