I have a C# library that I want to publish on Nuget. Currently it only builds if I target net8.0-windows because it has <UseWindowsForms>true</UseWindowsForms>.
However, it uses Windows Forms for only some functionality. I would like to conditionally exclude that functionality with #if directives so that I can still have a version of the library with the rest of the functionality that doesn’t rely on Windows Forms, and have that target net8.0 or netstandard2.0.
Is there a way to make UseWindowsForms conditional in this way?