Prerequisites
Summary
PowerShell 7.5 runs on .NET 9, but loads ASP.NET Core 8 LTS Microsoft.Extensions.* assemblies
(e.g. Microsoft.Extensions.ObjectPool.dll) from the PowerShell installation directory.
This version mismatch causes in-process dependency conflicts for PowerShell modules or libraries targeting net9.0
that depend on newer Microsoft.Extensions.* APIs or behaviors.
Because PowerShell loads modules into a single AssemblyLoadContext, the vendored ASP.NET Core 8 assemblies take
precedence and prevent net9.0 libraries from loading their expected dependencies.
Steps to reproduce
- Install the latest released PowerShell 7.5.x.
- Start a clean PowerShell session.
- Verify the runtime version:
[System.Runtime.InteropServices.RuntimeInformation]::FrameworkDescription
- Force-load
Microsoft.Extensions.ObjectPool:
$null = [Microsoft.Extensions.ObjectPool.DefaultObjectPoolProvider]
$asm = [AppDomain]::CurrentDomain.GetAssemblies() |
Where-Object { $_.GetName().Name -eq 'Microsoft.Extensions.ObjectPool' } |
Select-Object -First 1
$asm.Location
- Inspect the file metadata:
(Get-Item $asm.Location).VersionInfo |
Select-Object FileVersion, ProductVersion, ProductName
Expected behavior
When PowerShell reports that it is running on .NET 9, modules targeting net9.0 should be able to rely on
compatible Microsoft.Extensions.* assemblies, or there should be clear guidance and tooling support for managing
the version alignment.
Actual behavior
PowerShell 7.5 runs on .NET 9, but loads ASP.NET Core 8 LTS Microsoft.Extensions.* assemblies from its own
installation directory.
This leads to:
TypeLoadException
MissingMethodException
- subtle runtime incompatibilities
for modules built against Microsoft.Extensions.* 9.x APIs.
Error details
TypeLoadException / MissingMethodException when loading net9.0 libraries
that depend on newer Microsoft.Extensions.* APIs.
Environment data
Name Value
---- -----
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
.NET Runtime 9.0.10
Vendored Assembly Microsoft.Extensions.ObjectPool.dll
AssemblyVersion 8.0.0.0
FileVersion 8.0.2125.47515
ProductVersion 8.0.21
ProductName Microsoft ASP.NET Core
Assembly Location C:\Program Files\PowerShell\7.5
Visuals
No response
Prerequisites
Summary
PowerShell 7.5 runs on .NET 9, but loads ASP.NET Core 8 LTS
Microsoft.Extensions.*assemblies(e.g.
Microsoft.Extensions.ObjectPool.dll) from the PowerShell installation directory.This version mismatch causes in-process dependency conflicts for PowerShell modules or libraries targeting net9.0
that depend on newer
Microsoft.Extensions.*APIs or behaviors.Because PowerShell loads modules into a single AssemblyLoadContext, the vendored ASP.NET Core 8 assemblies take
precedence and prevent net9.0 libraries from loading their expected dependencies.
Steps to reproduce
[System.Runtime.InteropServices.RuntimeInformation]::FrameworkDescriptionMicrosoft.Extensions.ObjectPool:Expected behavior
When PowerShell reports that it is running on .NET 9, modules targeting net9.0 should be able to rely on
compatible
Microsoft.Extensions.*assemblies, or there should be clear guidance and tooling support for managingthe version alignment.
Actual behavior
PowerShell 7.5 runs on .NET 9, but loads ASP.NET Core 8 LTS
Microsoft.Extensions.*assemblies from its owninstallation directory.
This leads to:
TypeLoadExceptionMissingMethodExceptionfor modules built against
Microsoft.Extensions.*9.x APIs.Error details
Environment data
Visuals
No response