简体   繁体   中英

ASP.NET => Compiler Error Message: CS0246: The type or namespace name 'HtmlAgilityPack'

using HtmlAgilityPack;

// reference it

Produces error: ASP.NET => Compiler Error Message: CS0246: The type or namespace name 'HtmlAgilityPack' ...

HtmlAgilityPack IS referenced in my web site.

Switched from ASP.NET 2.0 to 4.0. After that, got this error. When making a console or windows forms application, all is fine, but ASP.NET build system gives me this error. I have this compile error when using HtmlAgilityPack.

No luck till today fixing this.

Had the same problem, my .NET project was targeting .NET Framework 4.0 but HtmlAgilityPack.dll was build with .NET Framework 4.5.

The solution was to reference the HtmlAgilityPack.dll build with .NET Fx 4.0.

The download package for HtmlAgilityPack offers versions for Net20, Net40, Net45 and even WinRT.

Please set the Copy Local property to True on the Referenced DLL of HtmlAgilityPack

This will copy the dll to the output directory of your application

So it worked before you changed the Framework Version to .Net 4?

If that's the case that sounds more like you also need to upgrade your dll to .Net 4.

Just get the release from Codeplex , in the zip there is a version of the AgilityPack for every Framework Version there is, just get the one for .Net 4 and see if that changes anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM