Prerequisites
Steps to reproduce
Update: The problem is specific to Windows ARM64 builds, irrespective of installation method - see below
Whether the WinForms and WPF assemblies ship with PowerShell Core depends on the installation method:
YES:
MSI package [the only reason this worked is because I accidentally installed the x64 version, not the ARM64 one]
NO:
Thus, WinForms code breaks with the latter two installation methods with ARM64 builds, because~~ Add-Type -AssemblyName System.Windows.Forms fails due to the absence of the relevant assemblies.
- Note: The .NET Framework version in the GAC is not found, though loading it explicitly with
Add-Type -LiteralPath C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Windows.Forms.dll does seem to work in practice.
Verify the presence / absence with:
Get-Item $PSHOME/System.Windows.Forms.dll
Is this a known / by-design? If so, it should at least be documented, with a detailed list of what's absent when not using the MSI installer.
Note that there's also technically distinct, but related problem (which also happens if the WinForms assemblies are present): the ability to load the WinForms assembly via using assembly System.Windows.Forms has been broken since using before v7..0:
Expected behavior
The file should be present.
Actual behavior
The file is present only if PowerShell was installed via the MSI installer
Error details
No response
Environment data
PowerShell Core v7.3.1 (.NET 7.0.0)
PowerShell Core v7.4.0-preview.1 (.NET 7.0.1)
on Microsoft Windows 11 Pro (ARM 64-bit Processor; Version 22H2, OS Build: 22621.963)
Visuals
No response
Prerequisites
Steps to reproduce
Update: The problem is specific to Windows ARM64 builds, irrespective of installation method - see below
Whether the WinForms and WPF assemblies ship with PowerShell Core depends on the installation method:YES:MSI package[the only reason this worked is because I accidentally installed the x64 version, not the ARM64 one]NO:winget install Microsoft.PowerShell(Microsoft Store)Installation via https://aka.ms/install-powershell.ps1Thus, WinForms code breaks
with the latter two installation methodswith ARM64 builds, because~~Add-Type -AssemblyName System.Windows.Formsfails due to the absence of the relevant assemblies.Add-Type -LiteralPath C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Windows.Forms.dlldoes seem to work in practice.Verify the presence / absence with:
Is this a known / by-design? If so, it should at least be documented, with a detailed list of what's absent when not using the MSI installer.Note that there's also technically distinct, but related problem (which also happens if the WinForms assemblies are present): the ability to load the WinForms assembly via
using assembly System.Windows.Formshas been broken since using before v7..0:using assemblystatement cannot be used to load well-known assemblies #11856Expected behavior
The file should be present.
Actual behavior
The file is present only if PowerShell was installed via the MSI installer
Error details
No response
Environment data
Visuals
No response