How to use .NET Framework 4.8 class library (that uses Devart.Data.SQLite.EF6 provider) in .NET 5.0 WinForms application

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
bairog
Posts: 119
Joined: Mon 29 Apr 2013 09:05

How to use .NET Framework 4.8 class library (that uses Devart.Data.SQLite.EF6 provider) in .NET 5.0 WinForms application

Post by bairog » Mon 25 Jan 2021 12:43

Hello.
I have .NET Framework 4.8 class library that uses Devart.Data.SQLite.EF6 provider (obtained via windows installer). It's was used for a couple of years in many .NET Framework 4.8 GUI applications.
Now we are moving forward to .NET 5.0 and creating some .NET 5.0 applications. But when I've tried to use .NET Framework 4.8 class library in .NET 5.0 WinForms application - I received an error:
Method not found: 'System.String System.AppDomainSetup.get_LicenseFile()'
Specific line of code that raises this exception is:

Code: Select all

SQLiteProviderFactory.Instance.CreateConnection();
Looks like it is a runtimes combination problem.
I cannot retarget class library from .NET Framework 4.8 to .NET 5.0 - there are lots of .NET Framework 4.8 applications that uses that class library.
I cannot use EF Core 5.0 instead of EF6.4.4 because it lacks Entity splitting support (it is used in our class library).
So how can I solve that problem?

Shalex
Site Admin
Posts: 9305
Joined: Thu 14 Aug 2008 12:44

Re: How to use .NET Framework 4.8 class library (that uses Devart.Data.SQLite.EF6 provider) in .NET 5.0 WinForms applica

Post by Shalex » Tue 26 Jan 2021 15:48

.NET 5 and .NET Core 1.x/2.x/3.x differ from .NET Framework, the details are described in the .NET Standard 1.x / 2.x specifications. One of the differences is the absence of the standard licensing mechanism that was adopted in .NET Framework, but not in .NET Core / .NET 5. The error you have encountered is due to the lack of implementation of the following method in .NET Core / .NET 5: https://docs.microsoft.com/en-us/dotnet ... icenseFile. There are other differences as well.

Therefore, we recommend you to use the same approach as other developers - in parallel, maintain 2 versions of the library for the .NET Framework and for .NET Standard / .NET Core / .NET 5.

With the version for .NET Standard 2.1 / .NET Core 3 / .NET 5, use our NuGet package https://www.nuget.org/packages/Devart.Data.SQLite.EF6/.

bairog
Posts: 119
Joined: Mon 29 Apr 2013 09:05

Re: How to use .NET Framework 4.8 class library (that uses Devart.Data.SQLite.EF6 provider) in .NET 5.0 WinForms applica

Post by bairog » Wed 27 Jan 2021 12:25

Shalex wrote: Tue 26 Jan 2021 15:48Therefore, we recommend you to use the same approach as other developers - in parallel, maintain 2 versions of the library for the .NET Framework and for .NET Standard / .NET Core / .NET 5.
Is it possible to have only one version of my library that target .NET Standard 2.0 (so it can be consumed from both .NET Framework 4.8 and .NET Core 3.1/.NET 5.0 applications)?

UPDATE I see now that your NuGet package targets .NET Standard 2.1.
Obviously because Entity Framework 6.4.4 targets .NET Standard 2.1 (and it is not going to target .NET Standard 2.0).
Looks like it is not going to have new versions at all.
So the only option to support both .NET Framework 4.8 and .NET Core 3.1/.NET 5.0 in a class library - is multi-targetting.

Post Reply