Forked from sdoubleday/PowerShell_Module_Manifests_Loading_Classes
Created
July 7, 2023 14:38
-
-
Save aldrichtr/41690fb4fa4956dd75489d8d2c8262ca to your computer and use it in GitHub Desktop.
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
#Classes do not always play well in the nested modules section of a manifest. I've had trouble with importing classes in multiple files. | |
#My current approach is: Create a .ps1 file WITHOUT the standard clauses of BEGIN{} PROCESS{} END{} that uses invoke-expressions: | |
$invocables = @() | |
$invocables += $( get-content "$PSScriptRoot\MyFolder\MyClass.psm1" ) -join "`r`n" | |
$invocables += $( get-content "$PSScriptRoot\MyOtherClassThatDepenedsOnTheFirstOne.psm1" ) -join "`r`n" | |
foreach ($i in $invocables) { Invoke-Expression -Command $i } | |
#Then put that file in the ScriptsToProcess node. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment