如何使用powershell调用dll中的方法?

时间:2016-12-23 08:39:15

标签: powershell

我需要使用Powershell ISE来运行dll中的方法,但它始终显示此错误:

  

无法找到类型[ExportTestResultNamespace.ExportTestResultClass]。   确保已加载包含此类型的程序集。在   C:\ selenium \ TestInPowerShell_Net.ps1:36 char:1   + [ExportTestResultNamespace.ExportTestResultClass] :: WriteAndRead()   + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~

     

CategoryInfo:InvalidOperation:(ExportTestResul ... TestResultClass:TypeName)[],RuntimeException   + FullyQualifiedErrorId:TypeNotFound

这是我的powershell代码:

[Reflection.Assembly]::LoadFile('c:\users\brian\documents\visual studio 2015\Projects\NunitTestLibrary\NunitTestLibrary\bin\Debug\NunitTestLibrary.dll') |Out-Null

$obj_ETC = [ExportTestResultNamespace.ExportTestResultClass]::Create()

$obj_ETC.WriteAndRead()

我真的不知道出了什么问题,有人能帮助我吗?

0 个答案:

没有答案