2

我需要使用 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
4

1 回答 1

2

您的问题是它默认针对 2.0 运行时运行我相信这个问题会告诉您如何解决它。

于 2012-07-25T12:43:55.077 回答