Update to DecompileResult move to XDocument
Fixes wixtoolset/issues#5896
Rob Mensching committed
Nov 2, 2018 at 23:43 UTC
3d49b0591a6fa2dc88c8df8915959959f81f4471
2 files changed
+7
-10
src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs
+1
-5
@@ -5,7 +5,6 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
5
using System;
6
using System.Collections.Generic;
7
using System.ComponentModel;
8
- using System.Xml.Linq;
8
using WixToolset.Core.Native;
9
using WixToolset.Data;
10
using WixToolset.Extensibility;
@@ -40,10 +39,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
39
var output = unbindCommand.Execute();
40
41
var decompiler = new Decompiler(this.Messaging, this.Extensions, this.Context.BaseSourcePath, this.Context.SuppressCustomTables, this.Context.SuppressDroppingEmptyTables, this.Context.SuppressUI, this.Context.TreatProductAsModule);
43
- var wxs = decompiler.Decompile(output);
44
-
45
- wxs.Save(this.Context.OutputPath, SaveOptions.OmitDuplicateNamespaces);
46
- result.SourceDocumentPath = this.Context.OutputPath;
42
+ result.Document = decompiler.Decompile(output);
43
44
// extract the files from the cabinets
45
if (!String.IsNullOrEmpty(this.Context.ExtractFolder) && !this.Context.SuppressExtractCabinets)
src/WixToolset.Core/CommandLine/DecompileCommand.cs
+6
-5
@@ -3,8 +3,8 @@
3
namespace WixToolset.Core.CommandLine
4
{
5
using System;
6
- using System.Collections.Generic;
6
using System.IO;
7
+ using System.Xml.Linq;
8
using WixToolset.Data;
9
using WixToolset.Extensibility;
10
using WixToolset.Extensibility.Data;
@@ -29,10 +29,6 @@ namespace WixToolset.Core.CommandLine
29
30
public IMessaging Messaging { get; }
31
32
- private IEnumerable<SourceFile> SourceFiles { get; }
33
-
34
- private string OutputPath { get; }
35
-
32
public int Execute()
33
{
34
if (this.commandLine.ShowHelp)
@@ -52,6 +48,11 @@ namespace WixToolset.Core.CommandLine
48
{
49
var decompiler = this.ServiceProvider.GetService<IDecompiler>();
50
var result = decompiler.Decompile(context);
51
+
52
+ if (!this.Messaging.EncounteredError)
53
+ {
54
+ result.Document.Save(context.OutputPath, SaveOptions.OmitDuplicateNamespaces);
55
+ }
56
}
57
catch (WixException e)
58
{