我正在尝试编写 PowerShell,但失败得很惨。
Set-ExecutionPolicy Unrestricted
Import-Module -Assembly PowerShellXrm.Framework.CI.PowerShell.dll
和
Set-ExecutionPolicy Unrestricted
Import-Module -Assembly "PowerShellXrm.Framework.CI.PowerShell.dll"
并得到以下错误。
Import-Module : Cannot bind parameter 'Assembly'. Cannot convert the
"PowerShellXrm.Framework.CI.PowerShell.dll" value of type "System.String"
to type "System.Reflection.Assembly".
At line:1 char:25
+ Import-Module -Assembly PowerShellXrm.Framework.CI.PowerShell.dll
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Import-Module], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ImportModuleCommand
PowerShell 脚本保存在与程序集相同的位置PowerShellXrm.Framework.CI.PowerShell.dll
。我也尝试过包含组装的完整路径,但没有运气。