我需要使用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发布于 2012-07-25 20:43:55
你的问题是它默认在2.0运行时运行,我相信这个question会告诉你如何解决这个问题。
https://stackoverflow.com/questions/11649849
复制相似问题