Az.NCache.psm1

# Az.NCache.psm1
# Loader for NCache Azure cmdlets

# Detect whether running on PowerShell Core or Desktop
$isCore = ($PSVersionTable.PSEdition -eq 'Core')

$moduleRoot   = $PSScriptRoot
$binaryFolder = if ($isCore) { 'core' } else { 'framework' }

# Pick the right DLL based on edition
$cmdletDll = if ($isCore) {
    Join-Path $moduleRoot "core\CloudTools.NetCore.dll"
} else {
    Join-Path $moduleRoot "framework\CloudTools.Net48.dll"
}

if (Test-Path $cmdletDll) {
    try {
        # Import the DLL as a PowerShell binary module
        Import-Module $cmdletDll -ErrorAction Stop -PassThru | Out-Null
        Write-Verbose "Loaded NCache cmdlets from $cmdletDll"
    }
    catch {
        Write-Error "Failed to import DLL $cmdletDll : $_"
    }
}
else {
    Write-Warning "Cmdlet DLL not found at $cmdletDll"
}

# No need to dot-source scripts here
# No need to Export-ModuleMember — DLL cmdlets are auto-exported