This will be a bit of a deep dive.
Nuget packages.config and packages folders are nice. They're pinned by default, they're a single point-of-truth for the dependencies of your powershell script, and the things you download are local to the packages folder instead of being global to the system.
Meanwhile, Powershell modules are global to the system, and installing a powershell module into a system changes behavior for every use of that system. So if I'm providing powershell code to teammates, I feel like it's rude to muddy up their system.
So, I've taken to using nuget.exe to fetch dependencies for my powershell code. Reference some modules in a packages.config file, and then nuget install them down, and then import them by path in my powershell code.
Nice encapsulated powershell where I don't have to think so much about the state of the messy shared powershell packages folder on the machine I'm running on.
But this is a little clumsy because I'm importing by path, and dependencies of dependencies don't work nicely.
So what I was thinking was: just add the Nuget Packages folder to my module search path temporarily! This almost works. The problem is the folder layout: Nuget packages are downloaded in the format PackageName.VersionNumber, while the module search looks for PackageName/VersionNumber. Nuget uses that format for its internal cache! But it doesn't use that for its packages folder.
Is there any way to fix that? To tell Nuget to lay out its packages folder cache-style instead of packages style? Then it would be a simple 3-line
& nuget restore $PSScriptRoot/packages.config
$Env:PsModulePath += ";$PSScriptRoot/packages"
import module FooModule
import module BarModule
Thanks.