MacOS - Compile to .exe

Hello. I would like to send my game to my friend, FindyKindly (sub to him on YouTube), but the problem is he doesn’t want to download Visual Studio to compile it himself, which I can understand, but how would I compile my game to a .exe file? I know it is possible, because I play Terraria which was made using XNA, and they DID compile it to a .exe. So, how would I do this?

Everything about this thread is perfect.


Don’t mind Martenfur, he’s our resident troll here :wink:

I don’t have any experience using a Mac myself, but I would expect it to be fairly similar to building for Android on Windows. I would expect you to need to create a project in your solution that targets the windows platform, then hook everything up so it runs your game.

Depending on your design, this can be non-trivial. It may help to isolate your non-platform specific code into a common library and then call that from your platform specific entry points. For platform specific runtime code (usually things like file access) that your common components need to use, you’ve got a couple options…

  • Extract an interface and create an implementation for each platform. In the platform specific entry point, hand a reference to the platform specific implementation to your common game code, but have your common code interact only with the interface.
  • Use #ifdef blocks in your code to check what platform you’re on and then put your platform specific code in there. I don’t advise this since it can get quite messy, but some folks like it and it can be faster to implement if you’re not comfortable with the first method, or if you don’t have a lot of platform specific code.

I can’t really give you any more specifics than that unless you have some more specific questions, though again, my Mac OS experience is virtually non-existent. Googling “MonoGame building multiple platforms” may yield some helpful results as well.

To publish a single file executable for Windows from a Macintosh, go to Terminal and into the directory of your .csproj or solution file and type:

dotnet publish -r win-x64

You will then find the Windows executable inside the directory of your solution. To create a file for other architectures, you can get the .Net Runtime Identifier here: