最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net - PowerShell is Throwing an Error About Loading an Assembly - Stack Overflow

programmeradmin0浏览0评论

I have an outside application from one of the company's software I support.

I configured a new Window Server 2022 to run this application. I also tested this on some other versions of Window too and getting a similar error.

When I attempt to load it, I get the following error:

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

It appears to me, since the PowerShell version matches the System.Management.Automation and the other VM's I tested it on, the error matches the PSVersion. I am not sure if it is a .Net error.

I am not sure where or how to download the reference assembly.

I also see NuGet is not installed on the Win 2022.

In response to a posted comment, the application is package as an exe file.

I have only ever worked with PowerShell as a native PowerShell files.

I have an outside application from one of the company's software I support.

I configured a new Window Server 2022 to run this application. I also tested this on some other versions of Window too and getting a similar error.

When I attempt to load it, I get the following error:

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

It appears to me, since the PowerShell version matches the System.Management.Automation and the other VM's I tested it on, the error matches the PSVersion. I am not sure if it is a .Net error.

I am not sure where or how to download the reference assembly.

I also see NuGet is not installed on the Win 2022.

In response to a posted comment, the application is package as an exe file.

I have only ever worked with PowerShell as a native PowerShell files.

Share Improve this question edited Feb 5 at 1:59 Charles05663 asked Feb 4 at 2:00 Charles05663Charles05663 154 bronze badges 5
  • 2 We would need details on this "outside application" in order to help. This is likely a .NET app that uses a System.Management.Automation version that is not compatible with your pwsh version – Santiago Squarzon Commented Feb 4 at 2:07
  • Thank you. I am going to spin up another VM, Windows 11 this time, and see if I can work around the error. I there away to download reference assembly and install it? – Charles05663 Commented Feb 4 at 3:40
  • 1 No, System.Management.Automation is the assembly that is PowerShell itself, you can't use a different version that the one you have. Downgrading it would mean using an older PowerShell version. – Santiago Squarzon Commented Feb 4 at 3:50
  • Please update your question to describe how your application is packaged (self-contained executable vs. runtime-dependent) and how it is being invoked. NuGet is a design-time utility and therefore isn't needed at runtime. – mklement0 Commented Feb 4 at 11:24
  • See following : learn.microsoft/en-us/powershell/module/… – jdweng Commented Feb 4 at 12:48
Add a comment  | 

1 Answer 1

Reset to default 0

First, thanks for the help.

The issue revolve around the version of PowerShell.

The documentation stated: PowerShell 7.4.5 64-bit or higher.

It turned out, it will only run in PowerShell 7.4.5.

Once I downgraded, everything worked as expected.

发布评论

评论列表(0)

  1. 暂无评论