如何正确添加.NET程序集到Powershell会话?
我有一个.NET程序集(一个DLL),这是一个API来备份我们在这里使用的软件。 它包含了一些我想在Powershell脚本中使用的属性和方法。 但是,我遇到了很多问题,首先加载程序集,然后使用任何types的程序集加载。 完整的文件path是: C:\rnd\CloudBerry.Backup.API.dll 在PowerShell中,我使用: $dllpath = "C:\rnd\CloudBerry.Backup.API.dll" Add-Type -Path $dllpath 我得到下面的错误: Add-Type : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. At line:1 char:9 + Add-Type <<<< -Path $dllpath + CategoryInfo : NotSpecified: (:) [Add-Type], ReflectionTypeLoadException + FullyQualifiedErrorId : System.Reflection.ReflectionTypeLoadException,Microsoft.PowerShell.Commands.AddTypeComma ndAdd-Type : Unable to […]