有人帮助我通过反射和Powershell加载此dll吗?

时间:2019-05-02 03:00:12

标签: reflection powershell-v4.0

我正在尝试将C#DLL加载到Powershell中。我已经搜索并尝试了许多不同的示例,我认为我做错了。我正在尝试调用DLL,并让DLL给我一个字符串。

DLL

namespace Decrypt
{
    public class Class1
    {
        public void Decrypt(out string dsn)
        {
            //Console.Write("test");
            dsn = "test";
        }
    }
}


$assembly = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom('c:\users\justin\desktop\decrypt.dll');
[Decrypt.Class1]::Decrypt.ToString();

MemberType          : Method
OverloadDefinitions : {string ToString()}
TypeNameOfValue     : System.Management.Automation.PSMethod
Value               : string ToString()
Name                : ToString
IsInstance          : True

0 个答案:

没有答案
相关问题