我需要在powershell脚本中使用我的dotnet core 3程序集之一:
try {
Add-Type -Path "app.dll"
}
catch {
$_.Exception.LoaderExceptions
}这将失败:
Could not load type 'System.Object' from assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because the parent does
not exist.为什么我尝试添加类型的System.Private.CoreLib.lib,同样的错误也发生了。它似乎可以很好地用于netstandard2.0程序集,但不能用于我的netcoreapp3.0程序集。要在powershell脚本中使用程序集的方法,我应该做些什么?
发布于 2021-08-08 22:39:10
如果您需要在PowerShell .NET程序集中加载netstandard2.0以上的版本,那么您应该尝试在PowerShell Core7.1.3或更高版本中执行您的脚本。
Windows PowerShell可能只能加载面向.NET框架或netstandard2.0的.NET程序集。
https://stackoverflow.com/questions/58390560
复制相似问题