What happens when .NET 4.0 references a .NET 2.0 assembly? - .net-2.0

What exactly does the .NET 4.0 runtime do if a .NET 4.0 executable contains a reference to a .NET 2.0 assembly?
Is the .NET 2.0 assembly run with the .NET 4.0 runtime (in other words, .NET 4.0 must be 100% API-compatible to .NET 2.0) or does the process somehow host the .NET 2.0 runtime and some magic happens to make the .NET 2.0 types transparently accessible to my .NET 4.0-based code?

They say it should work fine. Check out this.

Related

Is LiteDB known to work with dotnet Core 5.0?

I am about to port a Windows forms application (dotnet 4.7x) to dotNet Core 5. The application uses LiteDB (all else is straight c# winforms stuff). Before starting I need to determine if LiteDB 5.10 will work with Core 5.0.
LiteDB 5.x is .NET Framework 4.5 and .NET Standard 2.0 compatible. You can work with LiteDB in any target framework that .NE TStantard 2.0 is compatible, like:
.NET 5
.NET Core 2+
.NET Framework 4.6.1
Mono 5.4
Xamarin.iOS 10.14
Xamarin.Mac 3.8
Xamarin.Android 8
UWP 10.0.16299
Unity 2018.1
https://learn.microsoft.com/pt-br/dotnet/standard/net-standard

How to get a .NET core 3.1 Project work with .NET 5.0 project

When .NET 5.0 was released, one of the features mentioned was the ability to create a .NET 5.0 component, that it would work with .NET 3.1, so you wouldn't have to use .net standard between different versions.
Well, I tried to use .net 3.1 with .net 5.0 and I keep getting errors. Is there something special we have to do to make these work? We have multiple applications at my company that use various versions of .NET core. from 2.2, 3.0, 3.1 to .net 5.0. We would like to create some NuGet packages for some of the reusable components, but trying to figure out how to use .net core through out these applications, I don't want to create them with .net standard.
Has anyone run into this or not?
You did not provide the errors, but despite that, it can already be said that .NET 5 does not ensure backwards compatibility. Microsoft provides information on compatibility and breaking changes here.
.NET 5 merges together .NET Framework and .NET Core, ending the burden of keeping both; the aim is to also include Mono and Xamarin (MAUI). However, it does not ensure compatibility with previous versions. This is a good article on the subject - some features were delayed to .NET 6 though.
Hence, the best ways for you to have the compatibility you want would be to use .NET Standard or, even better, migrate the applications to .NET 5, since previous versions' support will end soon. In the team I work, we made some migrations from .NET Core 3.x to .NET 5 and it was pretty straightforward.
It is worth noticing that .NET 5 is not LTS. .NET 6, on the other hand, is. More details on .NET releases and support policies here.
A .net 5.0 library/dll cannot be referenced from a .net version less than .net 5.0. .net standard 2.1 should be used for compatibility between the different versions of .net core and .net 5.0.
On another note - its probably best to update all .net core projects to 5.0 assuming this is possible. The End of Life has been reached on .net core versions <= 3.0 (not .net standard).
see here.

C# SharpZipLib for .NET Core

We have version 0.86 of ICSharpCode.SharpZipLib.dll and it is not .NET Core compatible.
There appears to be two main (and several more) "latest" version of it. SharpZipLib and SharpZipLib.NETStandard, both by ICSharpCode.
Which is the correct one to use for .NET Core?
SharpZipLib runs on .NET Standard 2.0 in 2018.
Changes
The targeted frameworks are now:
.NET Standard 2.0 netstandard2 (Core 2.0+, FW 4.6.1+, Mono 5.2+, UWP 16299)
.NET Framework 4.5 net45 (Mono 4, Dependency-free on Windows 8+/2012+)
See: https://github.com/icsharpcode/SharpZipLib/wiki/Release-1.0
Use this one: https://www.nuget.org/packages/SharpZipLib/

how .net 1.1 application can work with .net 2.0 assembly

We have old .net 1.1 project that is using a third party component. Aparently that component is not working properly with new requirements, and there is no support from the provider. Provider proposed to use new component that is working properly. The problem is that this component requires .net 2.0.
The project is big and it will be costly to move this project to 2.0.
What other alternatives we can have? How 1.1 assembly can call 2.0 assembly?
.NET 1.1 can't load .NET 2.0 assemblies, because the internal format changed. Your app will basically think that the assembly isn't a .NET assembly.
Long term, it would be a good idea to update your application to use .NET 2.0 (if not something newer, since there are multiple versions of .NET since 2.0 now). However, if that is not an option, you could create a .config file for your executable, and tell the CLR to always use .NET 2.0 when running your app. This should allow for the .NET 2.0 assembly to load, however any breaking changes between .NET 1.1 and 2.0 that your app makes use of will cause errors.

.net 2.0 accessing .net 4.0 dll via assembly bindings

I have a .net 2.0 webservices using .net 2.0 librarys (dll). My config uses assembly binding to use the latest builds,Now the .net2.0 will be migrated to .net 4.0, does this mean i have to move my service to 4.0 as well?
Thanks
Gauls
running web app under clr 4.0 which can be done by changing IIS applicaton pool for the site to use .net 4.0.