With dotnet core 3.x you can have libraries which rely on System.Windows.Forms if you setup you project file properly.
- In the Project tag, make sure that you specify WindowsDesktop
- Include the UseWindowsForms tag in PropertyGroup
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
<RootNamespace>core_gdpicture</RootNamespace> | |
<UseWindowsForms>true</UseWindowsForms> | |
<IsPackable>false</IsPackable> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="nunit" Version="3.12.0" /> | |
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | |
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> | |
<PackageReference Include="System.Drawing.Common" Version="4.5.1" /> | |
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" /> | |
<PackageReference Include="VSI.GDIPicture.Net" Version="10.0.0.2" /> | |
</ItemGroup> | |
<ItemGroup> | |
<None Update="reo_feature_plan.pdf"> | |
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
</None> | |
</ItemGroup> | |
</Project> |