我正在尝试在 PowerShell 2.0中使用HTML Tidy .NET 包装器。
这是一个使用 C# 的工作示例(包装分发中包含的 TestIt.cs):
using Tidy;
Document tdoc = new Document();
我在 PowerShell 中这样做:
[Reflection.Assembly]::LoadFile("C:\Users\e-t172\Desktop\Tidy.NET\Tidy.dll")
New-Object Tidy.Document
我收到以下错误:
New-Object : Constructor not found. Cannot find an appropriate constructor for type Tidy.Document.
At line:1 char:11
+ New-Object <<<< Tidy.Document
+ CategoryInfo : ObjectNotFound: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand
附加信息:
> [Reflection.Assembly]::LoadFile("C:\Users\e-t172\Desktop\Tidy.NET\Tidy.dll").getTypes()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False ITidyDocumentEvents
True True TidyReportLevel System.Enum
True True __MIDL_ITidyDocument_0008 System.Enum
True False DocumentClass System.__ComObject
True False ITidyDocumentEvents_Event
True True ITidyDocumentEvents_OnMessageEventHan... System.MulticastDelegate
True False Document
True False ITidyDocument
True True TidyOptionId System.Enum
True True __MIDL_ITidyDocument_0002 System.Enum
False False ITidyDocumentEvents_SinkHelper System.Object
False False ITidyDocumentEvents_EventProvider System.Object
这是怎么回事?