Powershell dll loading

前端 未结 3 1883
有刺的猬
有刺的猬 2020-12-17 18:15

I have a Powershell script that calls a method in a C# library. The library dll is loaded as:

[Reflection.Assembly]::LoadFrom(\"$automationHome\\dll\\abc.dll         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 19:00

    LoadFrom() should ideally look for the xyz.dll in the same directory as abc.dll

    If you are running the script from the same directory as the dlls, add the below and then do the LoadFrom()

    $currentScriptDirectory = Get-Location
    [System.IO.Directory]::SetCurrentDirectory($currentScriptDirectory.Path)
    

提交回复
热议问题