Search code examples
exitmonogame

Monogame Exit() Obsolete for Desktop Program


I'm in the process of upgrading my Monogame project to the newest version (3.5).

I've systematically gotten rid of all the insane error messages (so far) except one:

Error   9   'Microsoft.Xna.Framework.Game.Exit()' is obsolete: 'This platform's policy does not allow programmatically closing.'

I'm just calling a simple "Exit()" when the user clicks the corresponding sprite in the UI.

case click.exit:
  Exit();
  break;

Is there a new way of telling the game I want to quit and return to Windows?


Solution

  • Fixed it.

    I created a new, blank project and used it as a reference to find the correct assembly to use in the existing project.

    For me, it was under:

    C:\Program Files (x86)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll

    This one wasn't showing up in the reference manager for some reason. I had to manually browse to it. No more errors about Exit().