I would like a module manifest file to reference one set of modules in my dev environment and another in my prod environment. The documentation says that if statements are permitted in psd1 files, but after a bunch of attempts I can’t make it work.
Could you please share a link to the documentation you’re refering to? As far as I remember are psd1 files PowerShell data files without any active code.
You could use a script to actually create a module manifest using the cmdlet New-ModuleManifest. This way you could create 2 different manifests for your different environments.
Thanks for responding. Here’s the doc I was referencing:
To address any scenarios that might not be covered by the base module manifest elements, you have the option to add additional code to your module manifest.
For security concerns, PowerShell only runs a small subset of the available operations in a module manifest file. Generally, you can use the if statement, arithmetic and comparison operators, and the basic PowerShell data types.
Would say that tying to point the root structure or psm1 path from root of the module is a bit unorthodox. Never seen a module that would reference a remote location and security most likely would not allow it. The module can be placed in a remote UNC share and modules can be imported via UNC, but you’ll see in this blog there are some security settings that need to be accounted for.
In my case the SharedLibraries share is in the Trusted Zones of all the servers that should need to use it. But I’m intrigued by the idea of a private repo and will explore that further.