【问题标题】:how to call my dll and use it in powershell script如何调用我的 dll 并在 powershell 脚本中使用它
【发布时间】:2013-07-31 18:26:51
【问题描述】:

我有自己的dll,它是用 c# 编写的。
现在我想从我的powershell 脚本中调用它。
我做了以下事情;

[System.Reflection.Assembly]::LoadFile("E:\MyClass.dll")
$MyCompObj = New-Object MyClass.Student

但是当我执行它时,它给了我错误
找不到构造函数。找不到适合 MyClass.Student 类型的构造函数

我是否按照错误的方式执行此操作??
请帮我解决这个问题。

【问题讨论】:

    标签: c# powershell


    【解决方案1】:

    你的类有构造函数(至少一个)。所以创建具有良好参数的对象

    $MyCompObj = New-Object MyClass.Student -argumentlist "arg1","Arg2" ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-23
      • 2014-02-28
      • 2012-03-07
      • 2017-02-11
      • 2022-01-24
      相关资源
      最近更新 更多