diff --git a/src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerDecompilerExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerDecompilerExtension.cs
index 8072cd88b..691244903 100644
--- a/src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerDecompilerExtension.cs
+++ b/src/api/wix/WixToolset.Extensibility/BaseWindowsInstallerDecompilerExtension.cs
@@ -36,13 +36,13 @@ public abstract class BaseWindowsInstallerDecompilerExtension : IWindowsInstalle
///
/// See
///
- public virtual void PreDecompile(IWindowsInstallerDecompileContext context)
+ public virtual void PreDecompile(IWindowsInstallerDecompileContext context, IWindowsInstallerDecompilerHelper helper)
{
this.Context = context;
- this.Messaging = context.ServiceProvider.GetService();
+ this.DecompilerHelper = helper;
- this.DecompilerHelper = context.ServiceProvider.GetService();
+ this.Messaging = context.ServiceProvider.GetService();
}
///
diff --git a/src/api/wix/WixToolset.Extensibility/IWindowsInstallerDecompilerExtension.cs b/src/api/wix/WixToolset.Extensibility/IWindowsInstallerDecompilerExtension.cs
index f7d54799d..cbeda1166 100644
--- a/src/api/wix/WixToolset.Extensibility/IWindowsInstallerDecompilerExtension.cs
+++ b/src/api/wix/WixToolset.Extensibility/IWindowsInstallerDecompilerExtension.cs
@@ -5,6 +5,7 @@ namespace WixToolset.Extensibility
using System.Collections.Generic;
using WixToolset.Data.WindowsInstaller;
using WixToolset.Extensibility.Data;
+ using WixToolset.Extensibility.Services;
///
/// Interface all windows installer decompiler extensions implement.
@@ -21,7 +22,8 @@ public interface IWindowsInstallerDecompilerExtension
/// Called before decompiling occurs.
///
/// Decompile context.
- void PreDecompile(IWindowsInstallerDecompileContext context);
+ /// Decompile helper.
+ void PreDecompile(IWindowsInstallerDecompileContext context, IWindowsInstallerDecompilerHelper helper);
///
/// Called before decompiling occurs.
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs
index fb560d1c9..267fe4954 100644
--- a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs
+++ b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs
@@ -39,16 +39,18 @@ public IWindowsInstallerDecompileResult Decompile(IWindowsInstallerDecompileCont
context.SymbolDefinitionCreator = this.ServiceProvider.GetService();
}
+ var decompilerHelper = context.ServiceProvider.GetService();
+
// Pre-decompile.
//
foreach (var extension in context.Extensions)
{
- extension.PreDecompile(context);
+ extension.PreDecompile(context, decompilerHelper);
}
// Decompile.
//
- var result = this.Execute(context);
+ var result = this.Execute(context, decompilerHelper);
if (result != null)
{
@@ -63,7 +65,7 @@ public IWindowsInstallerDecompileResult Decompile(IWindowsInstallerDecompileCont
return result;
}
- private IWindowsInstallerDecompileResult Execute(IWindowsInstallerDecompileContext context)
+ private IWindowsInstallerDecompileResult Execute(IWindowsInstallerDecompileContext context, IWindowsInstallerDecompilerHelper decompilerHelper)
{
// Delete the directory and its files to prevent cab extraction failure due to an existing file.
if (!String.IsNullOrEmpty(context.ExtractFolder) && Directory.Exists(context.ExtractFolder))
@@ -83,11 +85,11 @@ private IWindowsInstallerDecompileResult Execute(IWindowsInstallerDecompileConte
}
else
{
- return this.DecompileDatabase(context, backendHelper, fileSystem, pathResolver);
+ return this.DecompileDatabase(context, decompilerHelper, backendHelper, fileSystem, pathResolver);
}
}
- private IWindowsInstallerDecompileResult DecompileDatabase(IWindowsInstallerDecompileContext context, IWindowsInstallerBackendHelper backendHelper, IFileSystem fileSystem, IPathResolver pathResolver)
+ private IWindowsInstallerDecompileResult DecompileDatabase(IWindowsInstallerDecompileContext context, IWindowsInstallerDecompilerHelper decompilerHelper, IWindowsInstallerBackendHelper backendHelper, IFileSystem fileSystem, IPathResolver pathResolver)
{
var extractFilesFolder = context.SuppressExtractCabinets || (String.IsNullOrEmpty(context.CabinetExtractFolder) && String.IsNullOrEmpty(context.ExtractFolder)) ? null :
String.IsNullOrEmpty(context.CabinetExtractFolder) ? Path.Combine(context.ExtractFolder, "File") : context.CabinetExtractFolder;
@@ -106,7 +108,6 @@ private IWindowsInstallerDecompileResult DecompileDatabase(IWindowsInstallerDeco
var output = unbindCommand.Execute();
var extractedFilePaths = unbindCommand.ExportedFiles;
- var decompilerHelper = context.ServiceProvider.GetService();
var decompiler = new Decompiler(this.Messaging, backendHelper, decompilerHelper, context.Extensions, context.ExtensionData, context.SymbolDefinitionCreator, context.BaseSourcePath, context.SuppressCustomTables, context.SuppressDroppingEmptyTables, context.SuppressRelativeActionSequencing, context.SuppressUI, context.TreatProductAsModule);
var document = decompiler.Decompile(output);
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs b/src/wix/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs
index c085af9bc..ea0495981 100644
--- a/src/wix/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs
+++ b/src/wix/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs
@@ -2,8 +2,6 @@
namespace WixToolset.Core.WindowsInstaller
{
- using System;
- using System.Collections.Generic;
using WixToolset.Core.WindowsInstaller.ExtensibilityServices;
using WixToolset.Extensibility.Data;
using WixToolset.Extensibility.Services;
@@ -30,20 +28,11 @@ public static IWixToolsetCoreServiceProvider AddWindowsInstallerBackend(this IWi
private static void AddServices(IWixToolsetCoreServiceProvider coreProvider)
{
- // Singletons.
- coreProvider.AddService((provider, singletons) => AddSingleton(singletons, new WindowsInstallerBackendHelper(provider)));
- coreProvider.AddService((provider, singletons) => AddSingleton(singletons, new WindowsInstallerDecompilerHelper(provider)));
-
- // Transients.
coreProvider.AddService((provider, singletons) => new WindowsInstallerDecompiler(provider));
+ coreProvider.AddService((provider, singletons) => new WindowsInstallerDecompilerHelper(provider));
coreProvider.AddService((provider, singletons) => new WindowsInstallerDecompileContext(provider));
coreProvider.AddService((provider, singletons) => new WindowsInstallerDecompileResult());
- }
-
- private static T AddSingleton(Dictionary singletons, T service) where T : class
- {
- singletons.Add(typeof(T), service);
- return service;
+ coreProvider.AddService((provider, singletons) => new WindowsInstallerBackendHelper(provider));
}
}
}