Drop In replacement for System.Windows.Forms

I’m pretty new to C# and I’m trying to port a game from XNA 4 to Mono, but The only thing keeping me from Properly Compiling is that it can’t find or use System.Windows.Forms in the code. I’ve tried downloading the MonoGame.Forms NuGet package, but it isn’t drop in and I can’t just replace System.Windows.Forms with MonoGame.Forms because it doesn’t show up as usable.

Sorry if this is a repost or something, every other post that that I’ve talks about Forms stuff is for new projects, not migration projects.

If you’re targeting Windows specifically, you should still be able to use it, though admittedly it’s been a while since I’ve tried. Can you add a project reference to System.Windows.Forms?

Also, what functionality from that assembly are you using? Like, is it just some utility stuff or do you have an editor suite that you’ve created using various controls and whatnot?

I’m trying to make it cross platform, I’m using VS 22 and I can’t figure out how to add namespaces, but what namespace would I use for other platforms like Linux and/or game consoles. (I’m new to VS 22, so I’m having trouble finding my way around, all I can find online for adding namespaces is for visual basic and the documentation is not really helpful.) And functionality is for keyboard input for a multiplayer chat system and even If I didn’t care for Multiplayer at this moment, there’s too many references back to the code that it breaks everything else if I try to change it.

Ah, yea if you want cross-platform you’ll have to go with something else as System.Windows.Forms will only work on the Windows platform.

I’m not sure what you mean by “adding namespaces” though… like just creating a new one, or adding a project reference?

Anyway, as far as I know, there isn’t a cross-platform drop-in replacement for System.Windows.Forms. There are a lot of helpful libraries out there that might do similar functionality to what you’re looking for. If you find something that’s mostly compatible, or just want to write your own, you can make a pass-through by creating a wrapper for the object that’s in System.Windows.Forms and drive it by the other object.

Like…

namespace System.Windows.Forms
{
  public class SomeObjectYouUsed
  {
    private SomeNewTypeYouFound m_wrapped;

    public void SomeMethodYouUsed()
    {
      m_wrapped.DoSomethingAppropriate();
    }
  }
}

Sorry if that’s a bit generic… hopefully you get the idea. If I’ve made absolutely no sense here, it could be helpful to post some specific examples of things you’ve used from System.Windows.Forms that you need to hook back up.

You can still enable WinForms in net6 if you want.

Edit
I see that the template allrady has that. Perhaps you need to change the SDK type.