In our enterprise environment, we provision a packaged uwp app (packed as MSIX) with the cmd
Add-AppxProvisionedPackage -Online -SkipLicense -PackagePath [path-to-package].msix
Because we want all the user accounts on a device to have the same applications installed.
This works fine when having to install a newer version of an msix, but not when having to install a prior version. Specifically the error in this case is:
Add-AppxProvisionedPackage : Cannot create a file when that file already exists.
It looks like we need to install using an appinstaller file that specifies
<ForceUpdateFromAnyVersion>true</ForceUpdateFromAnyVersion> , but
Add-AppxProvisionedPackage does not support installing using an appinstaller file.
I came across this question about Provisioning Support for Appinstaller, however the methods specified there don't work for this scenario
- The first method - doing this:
Add-AppxProvisionedPackage -SkipLicense -Online -PackagePath .\FileName.msix
Add-AppxPackage -AppInstallerFile .\FileName.appinstaller
fails installing the lower-version package with
Add-AppxProvisionedPackage with the same error as described above, the "file already exists" error
- The second method - doing this:
$AppInstallerLocation = "C:\Users\MSIX\Desktop\AppInstallers\HeadTraxPkg_x64.appinstaller" [xml]$AppInstallerContent = [xml]$(Get-Content $AppInstallerLocation)
## Installs the AppxPackage
Add-AppxPackage -AppInstallerFile $AppInstallerLocation
## Forces the App to be Provisioned
$PackageFamilyName = $(Get-AppxPackage -Name $($AppInstallerContent.AppInstaller.MainPackage.Name) -Publisher $($AppInstallerContent.AppInstaller.MainPackage.Publisher)).PackageFamilyName
$PackageManager = new-object windows.management.deployment.packagemanager
- fails installing the lower-version package with
Add-AppxPackage with the following error
Add-AppxPackage : Deployment failed with HRESULT: 0x80070005, Access is denied.
So my question is - how can I install a lower version of a provisioned msix package, without uninstalling the existing one, from command line?