Search code examples
.net-core.net-4.5.net-standard

.Net Standard class library with WPF application and .NET Core Web app


I have,

  1. Existing class library written with .Net Framework 4.5.2
  2. Exiting WPF application written with .Net Framework 4.5.2
  3. WPF application using class library.

Now, I would like to create asp.net Core web app with dotnetcore 2.1 and want to reference the class library.

Do I need to,

  1. Convert class library with .Net Standard?
  2. Which version of .Net Standard so that I should be able to refer to my WPF application (with .Net Framework 4.5.2) which we can't convert to .Net Core UI app?

Solution

    1. Yes, you have to convert you libriary to .NET Standard in order to reference it from both Framework and .Net Core apps

    2. You would need to use .NET Standard version 1.2 or lower in order to support .NET Framework 4.5.2

    See the documentation for details: https://learn.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support