Skip to content

NET Standard 2 Incompatibility #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ColinM9991-zz opened this issue Sep 25, 2017 · 6 comments
Closed

NET Standard 2 Incompatibility #81

ColinM9991-zz opened this issue Sep 25, 2017 · 6 comments
Assignees

Comments

@ColinM9991-zz
Copy link

ColinM9991-zz commented Sep 25, 2017

I've been working on a new NET Standard 2.0 project which uses HtmlAgilityPack to parse and read HTML content. When I attempt to consume my NET Standard library from a NET Framework application, and the code gets so far as to execute the HtmlAgilityPack code then I am presented with the following exception.

System.IO.FileNotFoundException: 'Could not load file or assembly 'HtmlAgilityPack, Version=1.5.5.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'

I have created a simple solution which demonstrates this issue Here

@ColinM9991-zz
Copy link
Author

Closing this as this is actually the wrong issue to report.

@JonathanMagnan JonathanMagnan self-assigned this Sep 26, 2017
@twsouthwick
Copy link

I've filed a root cause issue of this: #86

@ColinM9991-zz ColinM9991-zz reopened this Oct 6, 2017
@ColinM9991-zz
Copy link
Author

ColinM9991-zz commented Oct 6, 2017

Reopening as this has gotten exposure.

@twsouthwick
I've found that placing the following element in the NET Framework project file does the trick
<DependsOnNETStandard>True</DependsOnNETStandard>

I don't believe this is an issue with this package, but more specifically with how dependencies are pulled in when a NET Framework project references a NET Standard project.

The following issues highlight this as being resolved, but evidently it is not.
dotnet/core#730
dotnet/sdk#1410

@JonathanMagnan
Copy link
Member

Hello @twsouthwick , and @ColinM9991 ,

I will close this issue since I don't think either that was related to Html Agility Pack.

Thank you for the link @ColinM9991

Best Regards,

Jonathan

@twsouthwick
Copy link

Please see the issue in #86 that describes why this is happening. The issues you linked to may be similar, but have to do more with resolving the correct version of an assembly. Please note that the entire, full assembly name including strong name, of what it is trying to resolve are consistent except for version. Version can be redirected with binding redirects, but assembly name and strong key cannot be.

The workaround you post will work when creating a .NET Standard 2.0 library and referencing from .NET 4.7. However, if you only have a portable version of some library, which depends on HtmlAgilityPack, and try to include it in a .NET Framework application, you will encounter the same error. This is because .NET Standard and the portable versions of HtmlAgilityPack are not signed.

@JonathanMagnan
Copy link
Member

Thank you @twsouthwick ,

Strong naming versions inconsistently has been fixed and will be released later today or tomorrow, so we will follow this problem in the issue you opened instead #86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants