I've seen a few conflicting answers about this topic so I'm hoping someone can lead to the right one. I'm building an API that uses devdept Eyeshot library. This library requires .net framework 4.8. I would like to use .NET 6 for my API because from what i can tell, Framework does not have great tools when it come to web development.
I've tried two different set-up's for my solution:
.NET 6 API with a .NET 6 class library where i tried to reference the relevant framework library.
.NET 6 API with framework 4.8 class library.
When I call the class i get the error -"Could not load type 'System.Runtime.Remoting.RemotingServices' from assembly 'mscorlib, Version=4.0.0.0'". But when i run it from a framework 4.8 API it works.
So is there and why at all to get this working with a .NET 6 API, no matter how complicated or does the API have to target the same framework?
In addition to the other answer (I was just going to post something similar), do note that when you reference a .NET Framework library from a .NET 6.0 app, the entire code will run in the .NET 6.0 runtime. There's no second execution environment created, therefore the .NET Framework library actually executes against the .NET 6.0 runtime library and fails if it requires features that no longer exists there. Many older libraries work fine that way, since the runtime is mostly backwards compatible, with some notable exceptions. 'System.Runtime.Remoting.RemotingServices
is one of them.