Normally, no.
But there is the Windows Compatibility Pack for .NET Core
Can I use .NET framework DLL in .NET core?
Hello All,
I have an .Net Core console application. Can I use .NET framework DLL in .NET core?
Please help me on this
2 answers
Sort by: Most helpful
-
Castorix31 81,741 Reputation points
2021-03-30T06:47:37.193+00:00 -
Karen Payne MVP 35,036 Reputation points
2021-03-30T13:22:09.037+00:00 You should consider taking the .NET Framework code and migrating to .NET Core. Benefits include faster execution of code when moving to .NET Core along with having the ability to use new features in C#8 and C#9.
The most challenging part of going to .NET Core is finding certain references such as in .NET Framework, in a class project if a reference for System.Windows.Forms was needed it's easy to do while in .NET Core one needs to find the reference by browsing to
C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\5.0.0\ref\net5.0
Then selecting System.Windows.Forms.dll
Or add commonly used references to the Object browser which also allows you to add a reference to the current project with a single click.
Cleaner code can be written e.g.
public static void ConventionalExample() { using (var cn = new SqlConnection(ConnectionString)) { cn.Open(); } } public static void CoreExample() { using var cn = new SqlConnection(ConnectionString); cn.Open(); }
In closing, best to use the older code as a bridge which gives time to write the .NET Core class project.