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>


Leave a Reply

Your email address will not be published. Required fields are marked *