问题描述
我遇到了NuGet软件包安装的库无法在PowerShell中运行的问题。我已经这样安装了它(也尝试过CurrentUser
范围和该软件包的更高版本,但最终没有区别):
Install-Package Microsoft.Bcl.AsyncInterfaces -Version 1.0.0.0
我使用的Microsoft.Bcl.AsyncInterfaces
模块需要 AWS.Tools
,但是无论我做什么,模块组装都找不到它。起初,我什至无法将类型添加到自己的会话中:
Add-Type -AssemblyName Microsoft.Bcl.AsyncInterfaces
添加类型:找不到路径'/home/username/src/work-aws/generate-hostname/Microsoft.Bcl.AsyncInterfaces.dll',因为它不存在。
但是我能够直接从软件包源目录中加载它:
Add-Type -Path "$(( Get-Package Microsoft.Bcl.AsyncInterfaces ).Source | Split-Path -Parent)/lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll"
但是... AWS模块中的程序集仍然看不到。我从AWS
类中得到的错误如下:
System.IO.FileNotFoundException:无法加载文件或程序集'Microsoft.Bcl.AsyncInterfaces,版本= 1.0.0.0,区域性=中性, PublicKeyToken = cc7b13ffcd2ddd51'。系统找不到指定的文件。
我在这里想念什么?我不确定如何获取该AWS模块以查看程序集,并且为什么在安装程序包后调用Add-Type
时PowerShell无法按名称解析程序集,我感到困惑。
编辑:我在这里发布了Exception变量的输出,因为我省略了错误的一些独特之处,尽管仍然找不到所有指示Microsoft.Bcl.AsyncInterfaces
的地方:
ErrorRecord : Exception calling "LoadTable" with "2" argument(s): "The type initializer for 'Amazon.DynamoDBv2.DynamoDBEntryConversion' threw an exception."
WasThrownFromThrowStatement : False
TargetSite : Void ConvertToMethodInvocationException(System.Exception,System.Type,System.String,Int32,System.Reflection.MemberInfo)
StackTrace : at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception,Type typeToThrow,String
methodName,Int32 numArgs,MemberInfo memberInfo)
at CallSite.Target(Closure,CallSite,Type,Object,String )
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site,T0 arg0,T1 arg1,T2 arg2)
at System.Management.Automation.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Message : Exception calling "LoadTable" with "2" argument(s): "The type initializer for 'Amazon.DynamoDBv2.DynamoDBEntryConversion' threw an exception."
Data : {System.Management.Automation.Interpreter.InterpretedFrameInfo}
InnerException : System.TypeInitializationException: The type initializer for 'Amazon.DynamoDBv2.DynamoDBEntryConversion' threw an exception.
---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces,Version=1.0.0.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51'. The
system cannot find the file specified.
Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces,PublicKeyToken=cc7b13ffcd2ddd51'. The
system cannot find the file specified.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeAssembly.get_DefinedTypes()
at Amazon.DynamoDBv2.DynamoDBEntryConversion.AddConverters(String suffix)
at Amazon.DynamoDBv2.DynamoDBEntryConversion.SetV1Converters()
at Amazon.DynamoDBv2.DynamoDBEntryConversion..ctor(ConversionSchema schema,Boolean isImmutable)
at Amazon.DynamoDBv2.DynamoDBEntryConversion..cctor()
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces,PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces,PublicKeyToken=cc7b13ffcd2ddd51'
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces,PublicKeyToken=cc7b13ffcd2ddd51'
--- End of inner exception stack trace ---
at CallSite.Target(Closure,String )
HelpLink :
Source : System.Management.Automation
HResult : -2146233087
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)