Powershell和HtmlAgilityPack

时间:2012-07-25 12:36:03

标签: .net powershell html-agility-pack

我需要使用Powershell进行一些屏幕抓取并运行本文

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

1 个答案:

答案 0 :(得分:2)

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