Not compatible with .Net 2.0

Topics: Developer Forum
Jul 12, 2012 at 9:12 PM

For unfortunate reasons, I cannot run a project in anything higher than .Net 2.0. With versions 1.4.4 and 1.4.3, the solution won't compile because it has dependencies requiring a higher .net version. It only builds with version 1.4.2.

Jul 12, 2012 at 10:43 PM

What kind of errors are you getting? Have you used the latest 1.4.5 source code? It builds for 2.0 target in VS2010 using the Solutions\HtmlAgilityPack.sln

Jul 13, 2012 at 3:18 AM

Hi, no, not using the source code, but including the binaries through NuGet. Here's the recipe:

  1. In Vs2010, create a new console application.
  2. Go to project properties, and set the target framework to .net 2.0
  3. Remove all references from the project (and using statements in program.cs).
  4. Right-click the project, manage nuget packages, search for HtmlAgilityPack and install (version 1.4.5)
  5. Now build and you get the following output.

------ Build started: Project: ConsoleApplication1, Configuration: Debug x86 ------

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3258: The primary reference "HtmlAgilityPack" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3258: The primary reference "HtmlAgilityPack" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3258: The primary reference "HtmlAgilityPack" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3258: The primary reference "HtmlAgilityPack" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3258: The primary reference "HtmlAgilityPack" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Data.SqlXml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3258: The primary reference "HtmlAgilityPack" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

ConsoleApplication1 -> C:\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe

========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

So it seems that when the binary was built, it had .net 4.0 versions of mscorlib, system, system.xml, system.configuration, system.data.sqlxml and system.security as references to the project.

Aug 2, 2012 at 8:41 AM

Hi,

I have the same problem here integrating the current 1.45 binaries in an .NET 3.5 Application.

dotPeek also shows the assembly as 4.0.

Maybe your .targets broke?

Aug 2, 2012 at 11:12 AM

I've the same problem.

Currently working on a .net 2.0 Projekt.
I'm in an urgent need to it. Does older versions work with .NET 2.0?