2012-07-25 100 views
2

我有一些屏幕抓取我需要使用PowerShell执行和整个本文PowerShell和HtmlAgilityPack

http://www.leeholmes.com/blog/2010/03/05/html-agility-pack-rocks-your-screen-scraping-world/

跑,并希望得到一个快速的演示和运行。但是,我马上遇到了一个麻烦,不知道为什么它会失败。

的代码如下:

add-type -Path "C:\TEMP\HtmlAgilityPack\Net20\HtmlAgilityPack.dll" 

马上,我得到以下错误:

PS C:\TEMP\HtmlAgilityPack\Net20> add-type -Path "C:\TEMP\HtmlAgilityPack\Net20\HtmlAgilityPack.dll" 
Add-Type : Could not load file or assembly 'file:///C:\TEMP\HtmlAgilityPack\Net20\HtmlAgilityPack.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 
At line:1 char:9 
+ add-type <<<< -Path "C:\TEMP\HtmlAgilityPack\Net20\HtmlAgilityPack.dll" 
    + CategoryInfo   : NotSpecified: (:) [Add-Type], BadImageFormatException 
    + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.AddTypeCommand 

回答

2

您的问题是,它默认为对2.0运行时上运行我相信这question告诉你如何解决它。