Skip to content

AngleSharp.Css 1.0.0-beta.139: Dependencies in csproj and nuspec do not match - leads to error in .Net Framework and .Net (Core) #167

Open
@GruberMarkus

Description

@GruberMarkus

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp.Css?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Xml for Xml support)
  • Did you perform a search in the issues?

Description

AngleSharp.Css 1.0.0-beta.139
Nuget downloads the wrong AngleSharp dependency, likely because of the following differing configurations:

  • nuspec file: <dependency id="AngleSharp" version="[1.0.0, 2.0.0)" />
  • csproj file: <PackageReference Include="AngleSharp" Version="1.1.0" />

With default settings (-DependencyVersion Lowest), NuGet downloads AngleSharp 1.0.0. This leads to problems in .Net Framework and .Net (Core), becauce AngleSharp.Css requires AngleSharp 1.1.0, not 1.0.0.

With -DependencyVersion Lowest, NuGet downloads AngleSharp 1.2.0-beta.410. This is not problem in .Net (Core), as it seems to automatically use the newer release. On .Net Framework, this leads to the following error:
Could not load file or assembly 'AngleSharp, Version=1.1.0.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea' or one of its dependencies. The system cannot find the file specified.

Steps to Reproduce

  1. nuget.exe install AngleSharp.Css -Framework net461 -Version "1.0.0-beta.139" -OutputDirectory ".\AngleSharp.Css_with-deps_net461" -NoHttpCache -DirectDownload -Verbosity quiet -DependencyVersion lowest
    or
    nuget.exe install AngleSharp.Css -Framework net461 -Version "1.0.0-beta.139" -OutputDirectory ".\AngleSharp.Css_with-deps_net461" -NoHttpCache -DirectDownload -Verbosity quiet -DependencyVersion highest
  2. Extract all net461 DLLs and place them in the same folder
  3. Import AngleSharp.Css.dll in .Net Framework,not in .Net (Core)
    System.Reflection.Assembly.LoadFrom("path-to-anglesharp.css.dll")
    or in PowerShell 5: import-module -Path "path-to-anglesharp.css.dll"
  4. As NuGet download AngleSharp 1.0.0 or 1.2.*, AngleSharp.Css can not load version 1.1.0, resulting in the error: Could not load file or assembly 'AngleSharp, Version=1.1.0.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea' or one of its dependencies. The system cannot find the file specified.

Expected Behavior

The NuGet package is configured to download the correct version of the AngleSharp dependency.

Actual Behavior

The NuGet package seems not to be configured to download the correct version of the AngleSharp dependency, and AngleSharp.Css on .Net Framework (not .Net (Core)) is bound to only use AngleSharp 1.1.0.

Possible Solution / Known Workarounds

Adopt the nuspec file, and maybe also a binding redirect (dotnet/announcements#31).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions