/// <summary> /// Gets the root directory for this application. /// </summary> /// <returns>WiX Directory element containing the root directory and all files.</returns> internal Wix.Directory GetApplicationRootDirectory() { if (null == this.source) { throw new ArgumentNullException("Source"); } IsolatedMsiBuilder msiBuilder = new IsolatedMsiBuilder(this.Core); msiBuilder.Source = this.source; return(msiBuilder.GetRootDirectory(true)); }
/// <summary> /// Builds the setup package and feed. /// </summary> /// <param name="outputFeed">Path to the file where feed will be generated.</param> /// <returns>True if fabrication was successful, false if any failure occurs.</returns> public override bool Fabricate(string outputFeed) { this.VerifyRequiredInformation(); try { this.Core = new FabricatorCore(this.MessageHandler); // Calculate the paths required to build the MSI. string localSetupFeed = outputFeed; Uri urlSetupFeed = new Uri(this.UpdateUrl, Path.GetFileName(localSetupFeed)); string outputMsi = Path.GetTempFileName(); string previousPackagePath = null; // Create the feed builder and open the previous feed if it was provided. FeedBuilder feedBuilder = new FeedBuilder(this.Core); if (this.previousFeedUrl != null) { feedBuilder.OpenPrevious(this.previousFeedUrl); previousPackagePath = feedBuilder.GetPreviousAppItemPath(); if (String.Compare(Path.GetExtension(previousPackagePath), ".exe", true) == 0) { previousPackagePath = SetupExeBuilder.GetEmbeddedPackage(previousPackagePath); } } // Create the MSI builder and open the previous package if there was one. IsolatedMsiBuilder msiBuilder = new IsolatedMsiBuilder(this.Core); if (previousPackagePath != null) { msiBuilder.OpenPrevious(previousPackagePath); } // Build the MSI. msiBuilder.Description = this.Description; msiBuilder.EntryFileRelativePath = this.EntryPoint; msiBuilder.Manufacturer = this.Manufacturer; msiBuilder.Name = this.Name; msiBuilder.Source = this.Source; msiBuilder.UpdateUrl = urlSetupFeed; msiBuilder.UpgradeCode = this.ApplicationId; msiBuilder.Version = this.ApplicationVersion; if (!msiBuilder.Build(outputMsi, this.saveWxsPath)) { return(false); } // Calculate the paths required to build the setup.exe. string relativeSetupExe = Path.Combine(msiBuilder.Version.ToString(), "setup.exe"); string localSetupExe = Path.Combine(Path.GetDirectoryName(outputFeed), relativeSetupExe); // Build the setup.exe. SetupExeBuilder setupExeBuilder = new SetupExeBuilder(this.Core); setupExeBuilder.MsiPath = outputMsi; if (!setupExeBuilder.Build(localSetupExe)) { return(false); } // Calculate the paths required for the app feed. Uri urlSetupExe = new Uri(this.updateUrl, relativeSetupExe); // Build the application feed. Note some values come from the MSI build because // they were updated there. feedBuilder.ApplicationId = msiBuilder.ProductCode; feedBuilder.ApplicationName = this.Name; feedBuilder.ApplicationVersion = msiBuilder.Version; feedBuilder.Description = this.Description; feedBuilder.Generator = "WiX Toolset's ClickThrough for Isolated Applications"; feedBuilder.Id = msiBuilder.UpgradeCode; feedBuilder.PackagePath = localSetupExe; feedBuilder.PackageUrl = urlSetupExe; feedBuilder.TimeToLive = this.updateRate; feedBuilder.Title = String.Concat(this.Manufacturer, "'s ", this.Name); feedBuilder.Url = this.UpdateUrl; return(feedBuilder.Build(localSetupFeed)); } finally { this.Core = null; } }