/// <summary> /// Emits WiX XML. /// </summary> /// <returns></returns> public override XContainer[] ToXml() { XNamespace bal = Compiler.IsWix4 ? "http://wixtoolset.org/schemas/v4/wxs/bal" : "http://schemas.microsoft.com/wix/BalExtension"; var root = new XElement("BootstrapperApplicationRef"); var app = this.ToXElement(bal + "WixStandardBootstrapperApplication"); var payloads = this.Payloads.ToList(); if (LicensePath.IsNotEmpty() && LicensePath.EndsWith(".rtf", StringComparison.OrdinalIgnoreCase)) { root.SetAttribute("Id", "WixStandardBootstrapperApplication.RtfLicense"); app.SetAttribute("LicenseFile", LicensePath); } else { if (LogoSideFile.IsEmpty()) { root.SetAttribute("Id", "WixStandardBootstrapperApplication.HyperlinkLicense"); } else { root.SetAttribute("Id", "WixStandardBootstrapperApplication.HyperlinkSidebarLicense"); } if (LicensePath.IsEmpty()) { //cannot use SetAttribute as we want to preserve empty attrs app.Add(new XAttribute("LicenseUrl", "")); } else { if (LicensePath.StartsWith("http")) //online HTML file { app.SetAttribute("LicenseUrl", LicensePath); } else { app.SetAttribute("LicenseUrl", System.IO.Path.GetFileName(LicensePath)); payloads.Add(new Payload(LicensePath)); } } } foreach (Payload item in payloads) { var xml = item.ToXElement("Payload"); root.AddElement(xml); } root.Add(app); return(new[] { root }); }
/// <summary> /// Emits WiX XML. /// </summary> /// <returns></returns> public override XContainer[] ToXml() { XNamespace bal = "http://schemas.microsoft.com/wix/BalExtension"; var root = new XElement("BootstrapperApplicationRef"); var app = new XElement(bal + "WixStandardBootstrapperApplication"); app.Add(this.MapToXmlAttributes()); if (LicensePath.IsNotEmpty() && LicensePath.EndsWith(".rtf", StringComparison.OrdinalIgnoreCase)) { root.SetAttribute("Id", "WixStandardBootstrapperApplication.RtfLicense"); app.SetAttribute("LicenseFile", LicensePath); } else { root.SetAttribute("Id", "WixStandardBootstrapperApplication.HyperlinkLicense"); if (LicensePath.IsEmpty()) { //cannot use SetAttribute as we want to preserve empty attrs app.Add(new XAttribute("LicenseUrl", "")); } else { if (LicensePath.StartsWith("http")) //online HTML file { app.SetAttribute("LicenseUrl", LicensePath); } else { app.SetAttribute("LicenseUrl", System.IO.Path.GetFileName(LicensePath)); root.AddElement("Payload").AddAttributes("SourceFile=" + LicensePath); } } } root.Add(app); return(new[] { root }); }