RehanSaeed / Schema.NET

Schema.org objects turned into strongly typed C# POCO classes for use in .NET. All classes can be serialized into JSON/JSON-LD and XML, typically used to represent structured data in the head section of html page.
MIT License
640 stars 80 forks source link

Version 12.0.0 has a dependency on .NET 7 in the .NET 6 build #598

Open kirk-marple opened 1 year ago

kirk-marple commented 1 year ago

Describe the bug

We have to stay on .NET 6 for now, because of some Azure Durable Entities issues, and I'm unable to upgrade to the latest Schema.NET because it's pulling in System.Text.Json 7.0.0, from the .NET 6.0 target.

Steps to reproduce

image

Expected behaviour

.NET 6.0 target shouldn't pull in any .NET 7 libraries

Schema objects

No response

Turnerj commented 1 year ago

Hey @kirk-marple - thanks for raising the issue. Strange that you can't upgrade as System.Text.Json v7.0.0 targets .NET 6 so I don't know why it wouldn't be working for you.

Are you hitting a specific error when upgrading to Schema.NET v12 due to this?

kirk-marple commented 1 year ago

Hi @Turnerj, downstream from this I'm using Azure Durable Entities, which isn't supported in .NET 7. I've run into dependency issues where if any 7.x.x .NET assemblies get pulled in, it causes problems finding other assemblies or has missing method exceptions. (Has happened with other packages than Schema.NET.)

So for now I've been keeping all my dependencies clear of anything 7.x.x, and avoiding any problems, until they release the next major version of Durable Entities (hopefully with .NET 8).

Turnerj commented 1 year ago

After talking with some other .NET developers, I think I understand what is going on. Basically Azure Durable Entities is (kinda) replacing our v7 libraries with v6 ones which, through binary breaking changes, causes a whole bunch of problems.

So its less the libraries causing the problem but rather the dumb setup with Azure Durable Entities (and certain other Azure products - I think I remember Azure Functions previously having the same problem come to think of it).

Anyway, I'll get a PR up shortly for optionally having the .NET 6 references for .NET 6 and the .NET 7 references for .NET 7.

kirk-marple commented 1 year ago

I just got bitten by this on another library. I have to check every package update now to see if it's bringing in System.Text.Json 7.0.x. If it happens, my Azure Functions won't load. Thankfully I learned how to use obj/project.assets.json to see where the references come from.

Appreciate you getting this resolved, and look forward to incorporating the new library.

RehanSaeed commented 12 months ago

I didn't know that the .NET libraries are tied to the .NET version. @Turnerj Can you share the resource you mention to learn about this?