8

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.

1 Answer 1

10

Your class has got constructors (at least one). So create the object with the good params

$MyCompObj = New-Object MyClass.Student -argumentlist "arg1","Arg2" ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.