Add winform support to a .NET 6,7,8 project

To add winforms support to an .NET class (Windows only) library add <UseWindowsForms>true</UseWindowsForms> to the project file. It will look like something below. (.NET 8.0)

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0-windows</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
   <UseWindowsForms>true</UseWindowsForms>
  </PropertyGroup>
</Project>


Lastest update in February 2024, inital post in February 2024

Write a comment

I appreciate comments, suggestions, compliments etc. Unfortunately I have no time to reply to them. Useful input will be used for sure!