'What is the reason for the error message '/hostfxr.dll is either not designed to run on Windows is it contains and error'?

I just opened a PowerShell console on Windows 11, and after running any command, it showed a dialog with a message like:

/hostfxr.dll is either not designed to run on Windows is it contains and error

Any ideas?



Solution 1:[1]

Just download the last hostfxr.dll from this website and copy it to this directory:

C:\Program Files\PowerShell\7

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hossein Yousefpour