MonoPack 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global MonoPack --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local MonoPack --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MonoPack&version=1.0.0
                    
nuke :add-package MonoPack --version 1.0.0
                    

<h1 align="center"> <img src="https://raw.githubusercontent.com/shyfox-studio/branding/51d21485b8b524893dd84a735f05d1bd154066f0/icons/monopack/monopack.svg" alt="ShyFox.MonoPack Logo" width="256" /> <br /> MonoGame Project Packer </h1>

<div align="center">

A dotnet tool that builds and packages MonoGame projects for Windows, macOS, and Linux. <br />

License: MIT

</div>

MonoPack is a dotnet tool used for MonoGame projects to package the game for Windows, Linux, and/or macOS.

Features

  • Can package for all three operating systems from any operating system.
  • Creates a macOS application bundle (.app) automatically for distribution.
  • Packages are compressed using zip compression for Windows packages and gz compression for Linux and macOS packages.

Installation

Add this as a dotnet tool to your current MonoGame project. In the same directory as the .csproj file for your MonoGame project, run the following command in a command prompt or terminal:

dotnet tool install MonoPack

Usage

MonoPack - MonoGame Project Packer
Usage: monopack [options] [project-path]

Options:
    -p --project <path>             Path to the .csproj file (optional if only one .csproj in current directory)
    -o --output <dir>               Output directory (default: [project]/bin/Packed)
    -r --runtime-identifier <rid>   Specify target runtime identifier(s) to build for.
    -i --info-plist <path>          Path to Info.plist file (required when packaging for macOS)
    -c --icns <path>                Path to .icns file (required when packaging for macOS)
    -v --verbose                    Enable verbose output
    -h --help                       Show this help message

Available runtime identifiers:
    win-x64     Windows
    linux-x64   Linux
    osx-x64     macOS 64-bit Intel
    osx-arm64   macOS Apple Silicon


Notes:
    If the --project path is not specified, an attempt will be made to locate
    the .csproj within the current directory.

    If a --runtime-identifier is not specified, a default one will be chosen
    based on the operating system.

    When the --runtime-identifier specified is osx-x64 and/or osx-arm64, paths
    to the Info.plist and the .icns file must be specified.  If they are not
    specified, an attempt is made to locate them in the current directory.

Examples:
    monopack
    monopack -h
    monopack -p ./src/MyGame.csproj -o ./artifacts/builds -r win-x64 -r osx-x64 -r osx-armd64 -r linux-x64 -i ./Info.plist -c ./Icon.icns

When executing the monopack command with no -r or --runtime-identifier flag(s), it will default to use the runtime identifier for the current operating system only.

You can specify -r osx-x64 for an Intel (x64) based macOS build only, or -r osx-arm64 for an Apple Silicon (arm64) based macOS build only.

If both are specified, then a universal build will be created.

When executing just monopack on a macOS, a universal build is selected by default.

If you are packaging for Linux or macOS from Windows, a message will be output in the console to inform you that you will need to manually apply the executable permissions on the Linux or macOS system once the archive is extracted to them.

--------
Warning: Building for Linux on Windows.
Perform the following once the archive has been extracted on Linux to make it executable:
   1. Open a terminal in the directory where the archive was unpacked to.
   2. Execute the command "chmod +x ./ExampleGame"
--------
--------
Warning: Building for macOS on Windows.
Perform the following once the archive has been extracted on macOs to make it executable:
   1. Open a terminal in the directory where the archive was unpacked to.
   2. Execute the command "chmod +x ./ExampleGame.app/Contents/MacOS/ExampleGame"
--------

This is because Windows does not have an equivalent of chmod or the concept of a file being executable or not, so that file attribute cannot be set on a Windows system.

When possible, you should package them on their intended system, such as through GitHub Actions if you don't have access to them yourself.

Required Files for macOS

When packaging for macOS, it is required that you have an Info.plist and an Apple Icon (.icns) file in your project directory. There is an example Info.plist in /example/ExampleGame/Info.plist. You can use this file and just replaced the required values for your game:

  • CFBundleExecutable: Update the string to be the same name as your project file (.csproj) minus the extension. For example, if your project file is named MyGame.csproj then you would use the following

    <key>CFBundleExecutable</key>
    <string>MyGame</string>
    
  • CFBundleIdentifier: Update the string to the identifier for your game.

  • CFBundleName: Update the string to be the same name as your project file (.csproj) minus the extension. For example, if your project file is named MyGame.csproj then you would use the following:

    <key>CFBundleName</key>
    <string>MyGame</string>
    

For the Icon.icns file, you can find a default MonoGame one in at /example/ExampleGame/Icon.icns. If you would like to create your own, there are tons of online tools for converting image files to the Apple Icon (icns) format. Just google.

License

MonoPack is licensed under the MIT License. Please refer to LICENSE for full license text.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.2.0 464 5/22/2025
1.1.0 247 5/14/2025
1.0.0 580 2/28/2025