Reputation: 465
I have my own dll
which written in c#.
Now I want to call that from my powershell
script.
I did the following;
[System.Reflection.Assembly]::LoadFile("E:\MyClass.dll")
$MyCompObj = New-Object MyClass.Student
But when I executing that, it giving me error
Constructor not found. Cannot find an appropriate constructor for type MyClass.Student
Am I following a wrong way to do this??
Please help me to fix this.
Upvotes: 8
Views: 19381
Reputation: 72680
Your class has got constructors (at least one). So create the object with the good params
$MyCompObj = New-Object MyClass.Student -argumentlist "arg1","Arg2" ...
Upvotes: 10