0
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.

1
  • Well if you look at the Reference section hope it doesn't have a yellow icon there ? Commented Aug 2, 2012 at 11:17

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

1 Comment

Where? The dll is always automatically copied to my bon-folder. I have VS 2010. It's no application, nor a web application, it's a website.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.