Closed raandree closed 1 year ago
I am now running into this problem on a number of projects. Additional input would be helpful on how to proceed here.
It's non-trivial iirc because some modules during compilation re-set some PSModulePath (namely PackageManagement) when you compile a mof that uses it (i.e. PowerShellGet). Being able to select what $Env:PSModulePath is set to from the build.yaml sounds like a good feature for Sampler. If you only want to cut down what's in $Env:PSModulePath, that might be more suited to Sampler.DscPipeline...
Thanks for the input. I am going to work on this next week and depending how generic and configurable the new task is going to be, we can put it either into Sampler.DscPipeline
or Sampler
.
Make sure that the BuiltModuleSubdirectory
also still works if used, e.g:
BuiltModuleSubdirectory: builtModule
@raandree is this fixed now in the recent PR?
Closing this as the task is in Sampler and works as intended (see ./.build/tasks/SetPsModulePath.build.ps1)
That said, I found that because how fragile the DSC compilation is, I wouldn't recommend using it, except in specific cases when people know what they're doing.
BuiltModuleSubdirectory
is for sure preferred when that's enough, which rarely is in WMF5.1 DSC.
Problem description
When using sampler for the DscWorkshop, you get compilation errors when the same DSC resource module exists multiple times on multiple locations.
For DSC build, we need to shorten the
PSModulePath
to point only tooutput/RequiredModules
plus paths that should be definable in thebuild.yml
@gaelcolas, is this something this should go in Sampler or rather in Sampler.DscPipeline?
Verbose logs
PowerShell version and build the target node is running
Module version used