user500741
user500741

Reputation: 873

Powershell and HtmlAgilityPack

I have some screen scraping I need to do using Powershell and ran across this article

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

And wanted to get a quick demo up and running. However, I'm running into a snag right away and not sure why it's failing.

The code is below:

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

Right away, I get the following error:

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

Upvotes: 2

Views: 4336

Answers (1)

rerun
rerun

Reputation: 25505

your issue is that its defaulted to run against 2.0 runtime I belive this question tells you how to solve it.

Upvotes: 2

Related Questions