@@ -156,6 +156,11 @@ func Install(dir string, ps *goolib.PkgSpec) error {
156
156
err = goolib .Run (exec .Command ("wusa" , args ... ), ec , out )
157
157
case ".exe" :
158
158
err = goolib .Run (exec .Command (s , in .Args ... ), ec , out )
159
+ case ".msix" , ".msixbundle" :
160
+ // Add-AppxProvisionedPackage will install for all users.
161
+ installCmd := fmt .Sprintf ("Add-AppxProvisionedPackage -online -PackagePath %v -SkipLicense" , s )
162
+ args := append ([]string {installCmd }, in .Args ... )
163
+ err = goolib .Run (exec .Command ("powershell" , args ... ), ec , out )
159
164
default :
160
165
err = goolib .Exec (s , in .Args , in .ExitCodes , out )
161
166
}
@@ -185,6 +190,9 @@ func Uninstall(dir string, ps *goolib.PkgSpec) error {
185
190
un .Args = commands [1 :]
186
191
un .Args = append ([]string {"/qn" , "/norestart" }, un .Args ... )
187
192
filePath = un .Path
193
+ case ".msix" , ".msixbundle" :
194
+ un .Path = ps .Install .Path
195
+ filePath = un .Path
188
196
default :
189
197
r := regexp .MustCompile (`[^\s"]+|"([^"]*)"` )
190
198
u := uninstallString (ps .Name , "" )
@@ -231,6 +239,11 @@ func Uninstall(dir string, ps *goolib.PkgSpec) error {
231
239
err = goolib .Run (exec .Command ("wusa" , args ... ), ec , out )
232
240
case ".exe" :
233
241
err = goolib .Run (exec .Command (filePath , un .Args ... ), ec , out )
242
+ case ".msix" , ".msixbundle" :
243
+ s := strings .Split (filepath .Base (filePath ), "_" )[0 ]
244
+ removeCmd := fmt .Sprintf (`Get-AppxProvisionedPackage -online | Where {$_.DisplayName -match "%v*"} | Remove-AppProvisionedPackage -online -AllUsers` , s )
245
+ args := append ([]string {removeCmd }, un .Args ... )
246
+ err = goolib .Run (exec .Command ("powershell" , args ... ), ec , out )
234
247
default :
235
248
err = goolib .Exec (filepath .Join (dir , un .Path ), un .Args , un .ExitCodes , out )
236
249
}
0 commit comments