I want to dynamically load dotnet assemblies at runtime.
Let's say I have netcore 3.1 console app:
- Can I load .net standard assemblies? If yes what specific version I can load?
- Can I load classic .net assemblies, like .net framework 4.8? If yes can I also load older versions?
What about reverse situation, when I have dotnet framework 4.8 console app:
- Can I load .net standard assemblies?
- Can I load older classic .net, like assemblies,.net framework 4.6?
.NET Standard is an interface - a versioned list of APIs that you can call.
.Net standard can be referenced by both .NET framework and .NET core.
You should use .Net standard for class libraries.
.NET framework and .NET core those two target a platform. .Net framework only works on Windows while .Net core works on all three(Windows/Linux/MacOS) operating systems. These should not reference one another.
So to quickly answer your questions.
What about reverse situation, when I have dotnet framework 4.8 console app:
The documentation is very clear on what you need to pay attention to. The text below is similar to the one in the screenshot. I added here to be more readable.
Guide
In addition to this ->https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
The link below provides the full info and also some troubleshooting tips for such errors.
Source: https://www.hanselman.com/blog/ReferencingNETStandardAssembliesFromBothNETCoreAndNETFramework.aspx