Closed
Labels
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
Install-PSResource AnyPackage.AppxExpected behavior
Module installs successfullyActual behavior
Install fails due to it not properly checking ExternalModuleDependenciesError details
Exception :
Type : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
Message : Package(s) 'anypackage.appx' could not be installed from repository 'PSGallery'.
HResult : -2146233088
TargetObject : Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
CategoryInfo : InvalidData: (Microsoft.PowerShel…s.InstallPSResource:InstallPSResource) [Install-PSResource],
ResourceNotFoundException
FullyQualifiedErrorId : InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
InvocationInfo :
MyCommand : Install-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 3
Line : Install-PSResource anypackage.appx -Verbose -TrustRepository
Statement : Install-PSResource anypackage.appx -Verbose -TrustRepository
PositionMessage : At line:1 char:1
+ Install-PSResource anypackage.appx -Verbose -TrustRepository
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Install-PSResource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
0
1Environment data
7.6.0-preview.3
Binary 1.1.1 Microsoft.PowerShell.PSResourceGetVisuals
No response
Activity
peetrike commentedon May 15, 2025
also, #1467
anamnavi commentedon Sep 10, 2025
Hi Thomas Nieto (@ThomasNieto) my apologies for the delay in triaging this! Looking at
AnyPackage.Appxmodule manifest it appears you've gotAppxlisted underRequiredModulesand underExternalModuleDependencies. PowerShell and PSResourceGet expect a dependency module to be listed under either manifest element not both. (ie it won't detect it in both and then exclude it fromRequiredModulesbecause it was listed underExternalModuleDependencies). So ifAppxis an external dependency remove it fromRequiredModuleswhen you next publish and then install should work or ensure Appx is present.We've updated the docs here to be clearer about the intent of
ExternalModuleDependenciespeetrike commentedon Sep 11, 2025
RequiredModuleshas 2 meanings:So when module is included under
ExternalModuleDependenciesbut not underRequiredModules, the required module is not loaded, when module is loaded.ThomasNieto commentedon Sep 29, 2025
Anam Navied (@anamnavi) can you please reopen this issue? As Meelis Nigols (@peetrike) says we need to have the module listed in
RequiredModulesfor the PowerShell engine to import the module before loading the desired one. This is for types and other such dependencies.PSResourceGet should do the following.
RequiredModulesand NOTExternalModuleDependenciesshould install required moduleRequiredModulesandExternalModuleDependenciesshould NOT install required module but write warning if module currently isn't present inPSModulePathExternalModuleDependenciesshould NOT install module but write warning if module currently isn't present inPSModulePath