Created
February 28, 2015 03:05
-
-
Save gpduck/3fd36df7714d9860f5ad to your computer and use it in GitHub Desktop.
Cyclic Dependency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ModulePath = Join-Path $env:USERPROFILE "Documents\WindowsPowerShell\Modules" | |
"m1","m2","m3","m4","m5","m6" | %{ mkdir (Join-Path $ModulePath $_ ) -ea 0 } | |
New-ModuleManifest -Path (Join-Path $ModulePath "m1\m1.psd1") -RequiredModules "m5","m2" | |
New-ModuleManifest -Path (Join-Path $ModulePath "m2\m2.psd1") -RequiredModules "m3","m4" | |
New-ModuleManifest -Path (Join-Path $ModulePath "m3\m3.psd1") -RequiredModules "m4" | |
New-ModuleManifest -Path (Join-Path $ModulePath "m4\m4.psd1") -RequiredModules "m5" | |
New-ModuleManifest -Path (Join-Path $ModulePath "m5\m5.psd1") | |
# m1 -----------------> m5 | |
# |-> m2 -----> m4 -----^ | |
# |-> m3 ---^ | |
#No cycles, this can be loaded m5, m4, m3, m2, m1 | |
#but this fails | |
ipmo m1 | |
#The required module 'm2' is not loaded. The module 'm2' has a requiredModule 'm4' in its module manifest 'm2.psd1' that points to a cyclic dependency. | |
#but then this works | |
ipmo m2 | |
ipmo m1 | |
#This will clean this mess up | |
#"m1","m2","m3","m4","m5","m6" | %{ rm -Recurse (Join-Path $ModulePath $_ ) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've opened a connect bug if anyone wants to vote for it.