2

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
Tomalak
  • 332,285
  • 67
  • 532
  • 628
user500741
  • 833
  • 5
  • 14
  • 25

1 Answers1

2

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

Community
  • 1
  • 1
rerun
  • 25,014
  • 6
  • 48
  • 78