Fix the loader to work on PowerShell 7.0 too (.NET 3.1).
The check Environment.Version.Major > 4 was not accurate to reflect whether we are running in .NET Core, for example, it fails when running in PowerShell 7.0.
Fix it by checking if the AssemblyLoadContext type is available at runtime.
PR Summary
Fix the loader to work on PowerShell 7.0 too (.NET 3.1). The check
Environment.Version.Major > 4
was not accurate to reflect whether we are running in .NET Core, for example, it fails when running in PowerShell 7.0. Fix it by checking if theAssemblyLoadContext
type is available at runtime.