Powershell Add -AppxProvisionedPackage -> Parameter: DependencyPackagePath with 2 strings fails

527 Views Asked by At

I try to give the AppxProvisionedPackage 2 parameters for DependencyPackagePath. But it don't work, i always get the error code:

Add-AppxProvisionedPackage : The parameter is incorrect.
At line:14 char:1
+ Add-AppxProvisionedPackage -Online -PackagePath $PackagePath -License ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-AppxProvisionedPackage], COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.AddAppxProvisionedPackageCommand

This is the (part) script:

$DependencyPackagePath1 = "C:\Web\admin_tmp\WinGetTemp\Microsoft.VCLibs.140.00.UWPDesktop_14.0.30704.0_x64__8wekyb3d8bbwe.appx"
$DependencyPackagePath2 = "C:\Web\admin_tmp\WinGetTemp\Microsoft.UI.Xaml.2.7_7.2203.17001.0_x64__8wekyb3d8bbwe.appx"
$DependencyPackagePaths =
@($DependencyPackagePath1, $DependencyPackagePath2)


# Specify the path to the app package
$PackagePath = "C:\Web\admin_tmp\WinGetTemp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"

# Specify the path to the license file (if required)
$LicensePath = "C:\Web\admin_tmp\WinGetTemp\license.xml"

# Provision the app package to the Windows image
Add-AppxProvisionedPackage -Online -PackagePath $PackagePath -LicensePath $LicensePath -DependencyPackagePath $DependencyPackagePaths -Verbose

I know i can write everything more compact, but i separated it for failure analysis. All paths are correct and it works with both dependency paths if I use only one of them, so the problem must be, how to give the DependencyPackagePath $DependencyPackagePaths parameter an array. Seems it can't work with arrays? I also tried to write it so:

DependencyPackagePath ($DependencyPackagePath1, $DependencyPackagePath2)

Or instead of the variables the path and filename.

How else can I write it, that my two strings are accepted by the -DependencyPackagePath parameter?

Thx in advance.

0

There are 0 best solutions below