↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

How to reference a .NET Core library in WinForms - Or, .NET Standard Explained

The post answers a common setup problem by separating the library target from the app target. The library should usually target .NET Standard, while the WinForms app can stay on .NET Framework. The example shown uses a NETCoreApp 1.1 class library and a WinForms app on .NET Framework 4.6.2, and the fix is to make the library netstandard.

Reading notes
#

  • The question is about reusing a class library from WinForms, not about running a whole .NET Core app inside WinForms.
  • .NET is used for several runtimes, including full .NET Framework, .NET Core, and Xamarin/Mono/Unity.
  • .NET Standard is not a runtime or platform; it is a versioned set of APIs that runtimes implement.
  • Newer .NET Standard versions expose more APIs, while lower versions are supported by more platforms.
  • For reusable libraries, the post recommends targeting the lowest .NET Standard version that still provides the APIs you need.
  • The apps that consume the library target a runtime platform, while the library itself targets .NET Standard.
  • In the example, changing the library to netstandard solved the problem.