Search code examples
c#.netwpfwinforms

Ignoring Windows projects during compilation on non-Windows machines


A solution has one C# project which targets net6.0-windows and uses Windows Forms and WPF libraries, the rest of the solution only targets net6.0. We need to make the solution compilable on multiple platforms and the net6.0-windows project is causing problems on non-Windows machines.

Is there a way to keep the Windows project in the solution and have it ignored when the solution is being compiled on non-Windows machines? The project does not need to be runnable on non-Windows machines, it should just not block the developers on such environments.


Solution

  • The following was missing in the Windows project configuration. After setting it, everything worked just fine:

    <EnableWindowsTargeting>true</EnableWindowsTargeting>