aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2025-11-02 00:03:07 -0700
committerRob Mensching <rob@firegiant.com>2025-11-03 14:03:39 -0800
commit33c12fa386aa7ace7a6bd06a45bc3ecf17e9c8f5 (patch)
tree3ef4849cfc28de598d6ec1d962b607fb374a54fb /src
parent2b709cb9662231ff7788147ad5c2ff5be6169160 (diff)
downloadwix-33c12fa386aa7ace7a6bd06a45bc3ecf17e9c8f5.tar.gz
wix-33c12fa386aa7ace7a6bd06a45bc3ecf17e9c8f5.tar.bz2
wix-33c12fa386aa7ace7a6bd06a45bc3ecf17e9c8f5.zip
Add support for perMachineOrUser
Resolves 9175
Diffstat (limited to 'src')
-rw-r--r--src/api/wix/WixToolset.Data/Symbols/WixPackageSymbol.cs1
-rw-r--r--src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs11
-rw-r--r--src/wix/WixToolset.Core/Compiler_Package.cs9
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/AllUsersFixture.cs12
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/AllUsers/PerMachineOrUser.wxs10
-rw-r--r--src/xsd/wix.xsd13
6 files changed, 52 insertions, 4 deletions
diff --git a/src/api/wix/WixToolset.Data/Symbols/WixPackageSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixPackageSymbol.cs
index 9601ec7a..82a98cc0 100644
--- a/src/api/wix/WixToolset.Data/Symbols/WixPackageSymbol.cs
+++ b/src/api/wix/WixToolset.Data/Symbols/WixPackageSymbol.cs
@@ -54,6 +54,7 @@ namespace WixToolset.Data.Symbols
54 PerMachine, 54 PerMachine,
55 PerUser, 55 PerUser,
56 PerUserOrMachine, 56 PerUserOrMachine,
57 PerMachineOrUser,
57 } 58 }
58 59
59 public enum WixPackageUpgradeStrategy 60 public enum WixPackageUpgradeStrategy
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
index 90b07776..8699ca2c 100644
--- a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
+++ b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
@@ -3056,9 +3056,16 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
3056 { 3056 {
3057 xAllUsers?.Remove(); 3057 xAllUsers?.Remove();
3058 } 3058 }
3059 else if (xAllUsers?.Attribute("Value")?.Value == "2" && xMsiInstallerPerUser?.Attribute("Value")?.Value == "1") 3059 else if (xAllUsers?.Attribute("Value")?.Value == "2")
3060 { 3060 {
3061 this.DecompilerHelper.RootElement.SetAttributeValue("Scope", "perUserOrMachine"); 3061 if (xMsiInstallerPerUser?.Attribute("Value")?.Value == "1")
3062 {
3063 this.DecompilerHelper.RootElement.SetAttributeValue("Scope", "perUserOrMachine");
3064 }
3065 else
3066 {
3067 this.DecompilerHelper.RootElement.SetAttributeValue("Scope", "perMachineOrUser");
3068 }
3062 3069
3063 xAllUsers?.Remove(); 3070 xAllUsers?.Remove();
3064 xMsiInstallerPerUser?.Remove(); 3071 xMsiInstallerPerUser?.Remove();
diff --git a/src/wix/WixToolset.Core/Compiler_Package.cs b/src/wix/WixToolset.Core/Compiler_Package.cs
index 466c87a3..e0af9695 100644
--- a/src/wix/WixToolset.Core/Compiler_Package.cs
+++ b/src/wix/WixToolset.Core/Compiler_Package.cs
@@ -93,6 +93,9 @@ namespace WixToolset.Core
93 case "perMachine": 93 case "perMachine":
94 // handled below after we create the section. 94 // handled below after we create the section.
95 break; 95 break;
96 case "perMachineOrUser":
97 scope = WixPackageScope.PerMachineOrUser;
98 break;
96 case "perUser": 99 case "perUser":
97 scope = WixPackageScope.PerUser; 100 scope = WixPackageScope.PerUser;
98 sourceBits |= 8; 101 sourceBits |= 8;
@@ -101,7 +104,7 @@ namespace WixToolset.Core
101 scope = WixPackageScope.PerUserOrMachine; 104 scope = WixPackageScope.PerUserOrMachine;
102 break; 105 break;
103 default: 106 default:
104 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perUser", "perUserOrMachine")); 107 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, installScope, "perMachine", "perMachineOrUser", "perUser", "perUserOrMachine"));
105 break; 108 break;
106 } 109 }
107 break; 110 break;
@@ -210,6 +213,10 @@ namespace WixToolset.Core
210 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "2", false, false, false, false); 213 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "2", false, false, false, false);
211 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "MSIINSTALLPERUSER"), "1", false, false, false, false); 214 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "MSIINSTALLPERUSER"), "1", false, false, false, false);
212 } 215 }
216 else if (scope == WixPackageScope.PerMachineOrUser)
217 {
218 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "2", false, false, false, false);
219 }
213 else if (scope == WixPackageScope.PerMachine) 220 else if (scope == WixPackageScope.PerMachine)
214 { 221 {
215 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "1", false, false, false, false); 222 this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "1", false, false, false, false);
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/AllUsersFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/AllUsersFixture.cs
index 0c1fd9e0..75c9a272 100644
--- a/src/wix/test/WixToolsetTest.CoreIntegration/AllUsersFixture.cs
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/AllUsersFixture.cs
@@ -23,6 +23,18 @@ namespace WixToolsetTest.CoreIntegration
23 } 23 }
24 24
25 [Fact] 25 [Fact]
26 public void CanCheckPerMachineOrUserMsi()
27 {
28 var propertyRows = BuildAndQueryPropertyTable("PerMachineOrUser.wxs");
29
30 WixAssert.CompareLineByLine(new[]
31 {
32 "_SummaryInformation:WordCount\t2",
33 "Property:ALLUSERS\t2"
34 }, propertyRows);
35 }
36
37 [Fact]
26 public void CanCheckPerUserMsi() 38 public void CanCheckPerUserMsi()
27 { 39 {
28 var propertyRows = BuildAndQueryPropertyTable("PerUser.wxs"); 40 var propertyRows = BuildAndQueryPropertyTable("PerUser.wxs");
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AllUsers/PerMachineOrUser.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AllUsers/PerMachineOrUser.wxs
new file mode 100644
index 00000000..c0137747
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/AllUsers/PerMachineOrUser.wxs
@@ -0,0 +1,10 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Package Id="WixToolsetTest.TestPackage"
3 Version="1"
4 Name="PerMachine Or User Msi"
5 Manufacturer="Example Corporation"
6 Scope="perMachineOrUser">
7
8 <File Source="PerMachineOrUser.wxs" />
9 </Package>
10</Wix>
diff --git a/src/xsd/wix.xsd b/src/xsd/wix.xsd
index 17111a00..cc0bc1dc 100644
--- a/src/xsd/wix.xsd
+++ b/src/xsd/wix.xsd
@@ -14187,6 +14187,16 @@
14187 </xs:documentation> 14187 </xs:documentation>
14188 </xs:annotation> 14188 </xs:annotation>
14189 </xs:enumeration> 14189 </xs:enumeration>
14190 <xs:enumeration value="perMachineOrUser">
14191 <xs:annotation>
14192 <xs:documentation>
14193 _New in WiX v7: WiX v7 adds this option to the Package Scope attribute._
14194 Set this value to declare that the package is [dual-purpose that can install per-machine or per-user](https://learn.microsoft.com/en-us/windows/win32/msi/single-package-authoring)
14195 and defaults to installing per-machine.
14196 Sets the ALLUSERS property to 2.
14197 </xs:documentation>
14198 </xs:annotation>
14199 </xs:enumeration>
14190 <xs:enumeration value="perUser"> 14200 <xs:enumeration value="perUser">
14191 <xs:annotation> 14201 <xs:annotation>
14192 <xs:documentation> 14202 <xs:documentation>
@@ -14198,7 +14208,8 @@
14198 <xs:enumeration value="perUserOrMachine"> 14208 <xs:enumeration value="perUserOrMachine">
14199 <xs:annotation> 14209 <xs:annotation>
14200 <xs:documentation> 14210 <xs:documentation>
14201 Set this value to declare that the package is [dual-purpose that can install per-user or per-machine](https://learn.microsoft.com/en-us/windows/win32/msi/single-package-authoring). 14211 Set this value to declare that the package is [dual-purpose that can install per-user or per-machine](https://learn.microsoft.com/en-us/windows/win32/msi/single-package-authoring)
14212 and defaults to installing per-user.
14202 Sets the ALLUSERS property to 2 and MSIINSTALLPERUSER property to 1. 14213 Sets the ALLUSERS property to 2 and MSIINSTALLPERUSER property to 1.
14203 </xs:documentation> 14214 </xs:documentation>
14204 </xs:annotation> 14215 </xs:annotation>