Update: In later versions of VS 2019 (I tried Version 16.8.2) there is a project template for Windows Forms Control Library for .NET Core.
Currently Windows Forms .NET Core is in Preview mode and I don't know any official Nuget package or Project template for Windows Forms Control Library in .NET Core in VS 2019 16.2.2.
But to create a Windows Forms Control Library, you can use the following instructions:
- Add a new project of type Class Library (.NET Core)
- After project created, right click on project file and choose Edit Project File
- Change the project SDK to
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
- Specify windows forms as UI technology by adding
<UseWindowsForms>true</UseWindowsForms>.
Now the project file should be like the following:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
Now you can add Windows forms elements like Form or UserControl to this project and build the project without any problem.