New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add-AppxPackage doesn't handle string array param DependencyPath in PS7 #18708
Comments
|
This was noticed in the Add-AppDevPackage.ps1 script that gets shipped with Visual Studio, see https://developercommunity.visualstudio.com/t/Installps1-script-fails-to-install-depe/10186233
|
|
@MSLukeWest I think on quick reading and not being able to replicate as I don't work with msix's I think that you may have missed out a vital step out Can you try this and see if that works instead $DependencyPackages = @()
$DependencyPackages += "c:\Package\Dependencies\Foo.msix"
$DependencyPackages += "c:\Package\Dependencies\Bar.msix"
$DependencyPackages = Get-item $DependencyPackages
Add-AppxPackage -Path "c:\Package\Main.msix" -DependencyPath $DependencyPackages.FullName -ForceApplicationShutdown |
|
@kilasuit Thanks for taking a look. I realized that in trying to simplify the repro steps I made a mistake, which has now been corrected under "Steps To Reproduce". Can you take another look? |
|
@kilasuit Can you take a look at my updated repro steps above? |
|
@kilasuit is there something that the Add-AppxPackage can do to work around this issue? the script works fine in Windows PowerShell, but it is failing in pwsh core. This is causing app installs to fail when initiated from pwsh, so it's a pretty high priority for us. |
|
CC @SteveL-MSFT could you please help unblock us? 🙏 |
|
The problem appears to be that the PS remoting generated proxy function incorrectly has the 1 > 1.msix
2 > 2.msix
main > main.msix
$deps = gci ?.msix
$main = gci main.msix
add-appxpackage -path $main.fullname -dependencypath $deps.fullnameOn Windows 11, the AppX module has been fixed to work directly in PS7, so remoting isn't used and the original command will work. Given that PS remoting is generating the proxy function and getting the signature wrong, I don't have a workaround for now for older Win 10 that still relies on PS remoting to Windows PowerShell to use AppX module. |
|
thanks @SteveL-MSFT - note that I'm hitting this on the latest internal Windows 11 builds, so even there it's not working as expected |
|
@asklar sorry, just checked my Win 11 system and the AppX module still reports itself as not PS7 compatible, so a WinPS session is created and remoting has this problem. |
|
I debugged this and the problem is this helper function which only handles @PaulHigin do you know if this design is intended? I see there's another help to check type safety, but by the time that code is reached, it's either a switchparameter or object. |
|
@PaulHigin any updates? we're currently blocked by this. |
|
Same problem when running install scripts generated by VS. |
|
Any updates? Can we see this as a bug that should be fixed in powershell that the receiving parameters are not the same type as documented? Compared to the https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/copy-item?view=powershell-5.1 https://learn.microsoft.com/es-es/powershell/module/appx/add-appxpackage?view=winserver2012-ps Thank you!
|




Prerequisites
Steps to reproduce
Call Add-AppxPackage in PS7, passing in an array of paths for the DependencyPath argument
Required Setup: "c:\Package\Dependencies" contains two msix files, Foo.msix and Bar.msix
$DependencyPackages = @()
$DependencyPackages += Get-ChildItem ("c:\Package\Dependencies*.msix") | Where-Object { $_.Mode -NotMatch "d" }
Add-AppxPackage -Path "c:\Package\Main.msix" -DependencyPath $DependencyPackages.FullName -ForceApplicationShutdown
Expected behavior
Add-AppxPackage successfully installs dependencies Foo and Bar. This is how 5.1 works.
Actual behavior
It combines the two array items into a single string, resulting in error:
Add-AppxPackage: Cannot find path 'c:\Package\Dependencies\Foo.msix c:\Package\Dependencies\Bar.msix' because it does not exist.Error details
OriginInfo : localhost
Exception :
Type : System.Management.Automation.RemoteException
SerializedRemoteException : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ResolveArgumentPath(String path)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.EvaluateParameters()
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
ErrorRecord :
Exception :
Type : System.Management.Automation.RemoteException
SerializedRemoteException : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ResolveArgumentPath(String path)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.EvaluateParameters()
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
ErrorRecord :
Exception :
Type : System.Management.Automation.RemoteException
SerializedRemoteException : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ResolveArgumentPath(String path)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.EvaluateParameters()
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
ErrorRecord :
Exception :
Type : System.Management.Automation.RemoteException
SerializedRemoteException : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ResolveArgumentPath(String path)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.EvaluateParameters()
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
ErrorRecord :
Exception :
Type : System.Management.Automation.RemoteException
SerializedRemoteException : System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, ProviderInfo& provider, CmdletProvider& providerInstance)
at System.Management.Automation.PSCmdlet.GetResolvedProviderPathFromPSPath(String path, ProviderInfo& provider)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ResolveArgumentPath(String path)
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.EvaluateParameters()
at Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
SerializedRemoteInvocationInfo : System.Management.Automation.InvocationInfo
ErrorRecord : …
Message : Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
HResult : -2146233087
TargetObject : C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx
CategoryInfo : ObjectNotFound: (C:\Users\lukewest\D…Libs.x64.14.00.appx:String) [Add-AppxPackage], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
Message : Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
HResult : -2146233087
TargetObject : C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx
CategoryInfo : ObjectNotFound: (C:\Users\lukewest\D…Libs.x64.14.00.appx:String) [Add-AppxPackage], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
Message : Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
HResult : -2146233087
TargetObject : C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx
CategoryInfo : ObjectNotFound: (C:\Users\lukewest\D…Libs.x64.14.00.appx:String) [Add-AppxPackage], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
Message : Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
HResult : -2146233087
TargetObject : C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx
CategoryInfo : ObjectNotFound: (C:\Users\lukewest\D…Libs.x64.14.00.appx:String) [Add-AppxPackage], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
Message : Cannot find path 'C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx' because it does not exist.
HResult : -2146233087
TargetObject : C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx C:\Users\lukewest\Desktop\1667099_Repro\Uwp\App8_1.0.0.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx
CategoryInfo : ObjectNotFound: (C:\Users\lukewest\D…Libs.x64.14.00.appx:String) [Add-AppxPackage], ItemNotFoundException
FullyQualifiedErrorId : PathNotFound,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: