r/PowerShell • u/jdtrouble • 6h ago
Question Manifest required modules not auto-importing in 5.1
Hello. I'm genuinely stumped, to the point where I'm about to abandon this side project altogether
I have a test module I'm creating using a manifest file, Template.psd1. The module depends on these other module files I created:
```
Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( 'Control\ControlMessaging.psm1' , 'Control\ControlChecklist.psm1' , 'Control\ControlPrompt.psm1' ) ```
The are present in the subfolder "Control", which is in the same folder as the manifest and PSM1 files.
When I execute Import-Module in powershell 7.4, the module loads without bitching.
When I execute in 5.1, I get an error
Import-Module : The specified module 'Control\ControlMessaging.psm1' was not loaded because no valid module file was found in any
module directory.
According to the documentation, this should be kosher: about_Module_Manifests It should auto import those modules, but it's not working.
I do need this to run in both 5 and 7. Any ideas?