Svrooij.MicrosoftTeams.psm1
|
# Repackaged module wrapper - orchestrates loader and original module logic # This wrapper ensures the generic loader's AssemblyLoadContext is initialized before # the original .psm1 runs, so all its imports and assembly loads are resolved correctly. $ModuleRoot = Split-Path -Parent $MyInvocation.MyCommand.Path Write-Debug "Repackaged module wrapper starting. Module root: $ModuleRoot" # The generic loader (NestedModule) has been imported before this script runs. # It has initialized the AssemblyLoadContext and registered the assembly resolver. # Now dot-source the original module so all its orchestration logic runs in this context. $OriginalModule = Join-Path $ModuleRoot 'MicrosoftTeams.original.ps1' if (-not (Test-Path $OriginalModule)) { Write-Error "Original module script not found at: $OriginalModule" throw "Failed to locate original module: MicrosoftTeams.original.ps1" } Write-Debug "Dot-sourcing original module: $OriginalModule" try { . $OriginalModule Write-Debug "Successfully dot-sourced original module" } catch { Write-Error "Error dot-sourcing original module: $_" throw } |