We are moving our standalone scripts into modules. We have created a module that uses nested modules. The module itself is just a utility that contains the nested modules. The structure is like this:
Utility
Utility.psd1
DoSomething
Get-Something.psm1
In the manifest we have set up the nested module information like so
NestedModules = @(‘DoSomething\Get-Something.psm1’)
FunctionsToExport = ‘*’
ModuleList = @()
Test-ModuleManifest says everything is fine. Using Import-Module to load the module works. Get-Command -Module Utility displays the command(s) correctly. Executing them works. So as far as I can tell everything is working correctly.
Now we generate a NuGet package for the module and upload it to our private gallery. I am able to see the module in the repo via Find-Module. I am able to install it using Install-Module. I go to the %Program Files%\WindowsPowershell\modules path and it has properly extracted it to the required layout that is recommended. Everything looks great.
Now I try to run Import-Module and I get the error - import-module : The specified module ‘Fsmb.Utility’ was not loaded because no valid module file was found in any
module directory.
Trying to use Get-Command on the module shows no commands.
What would be preventing this from working when installed via a repo vs importing it directly?
Note that I’ve also tried setting (in the manifest) ModuleList to the same set of values as NestedModules. It had no effect. Since redeploying to the repo is a pain I simply edited the .psd1 file that was installed into the folder mentioned earlier. So unless PS is caching the manifest data somewhere it should have detected the module list.