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

最佳答案

您的问题是它默认运行于2.0运行时,我相信此ojita会告诉您如何解决它。

关于.net - Powershell和HtmlAgilityPack,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11649849/

10-10 02:33