From 4dcde245aee72f7bb52af4525e7e8d23cb7135e7 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 13 Aug 2025 22:57:52 -0400 Subject: Decompile Scope=perUserOrMachine. Fixes https://github.com/wixtoolset/issues/issues/9144 --- .../Decompile/Decompiler.cs | 8 ++++++++ .../TestData/DecompileNullComponent/Expected.wxs | 2 +- .../TestData/DecompileNullComponent/example.msi | Bin 32768 -> 32768 bytes 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 9cc3d88e..90b07776 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs @@ -3051,10 +3051,18 @@ namespace WixToolset.Core.WindowsInstaller.Decompile else { var xAllUsers = this.DecompilerHelper.RootElement.Elements(Names.PropertyElement).SingleOrDefault(p => p.Attribute("Id")?.Value == "ALLUSERS"); + var xMsiInstallerPerUser = this.DecompilerHelper.RootElement.Elements(Names.PropertyElement).SingleOrDefault(p => p.Attribute("Id")?.Value == "MSIINSTALLPERUSER"); if (xAllUsers?.Attribute("Value")?.Value == "1") { xAllUsers?.Remove(); } + else if (xAllUsers?.Attribute("Value")?.Value == "2" && xMsiInstallerPerUser?.Attribute("Value")?.Value == "1") + { + this.DecompilerHelper.RootElement.SetAttributeValue("Scope", "perUserOrMachine"); + + xAllUsers?.Remove(); + xMsiInstallerPerUser?.Remove(); + } } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs index 3d15dd3e..1f0dea36 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs @@ -1,5 +1,5 @@ - + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi index 81335041..42b1d124 100644 Binary files a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi and b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi differ -- cgit v1.2.3-55-g6feb