How to run project built in release mode

I am using MonoGame 3.8 on Windows 10. I compile a MonoGame Cross-Platform Desktop Application (OpenGL) with Visual Studio 2019 in release mode. I try to run the .exe file on Windows 10, works fine. I try to run the .exe file on a Linux system (Ubuntu 18.04) (Open With Mono Runtime (Terminal)) and I get an error “File does not contain a valid CIL image”. How am I supposed to run my game on Linux?

MG3.8 is build using netcore, mono!=netcore.

Install netcore to linux or make .net framework project, compile monogame to .net 4.7 or so and then it works with mono.

What about publishing a self-contained project? If you want to publish your game to other people then maybe you shouldn’t require manually installing something else first. Don’t know what is common to do on Linux though.

Only problem is when I execute the program I get a black window. I think it’s because of an error I also got when using mono on the dll “IsolatedStorageException: No ApplicationIdentity available for AppDomain”

Edit: Maybe this error is because I use IsolatedStorageFile.GetUserStoreForApplication() for saving and loading options, which might not be cross platform.

Then add the --self-contained flag. Publish apps with the .NET CLI - .NET | Microsoft Learn

Is that a question or a statement? Either way software have had other dependencies for decades already, so it’s not bad practice in itself, but it should be your responsibility as a developer to make sure that any additional dependencies are automatically installed so the user doesn’t have to go through any extra hassle. If you publish your games through steam there will be an option to add extra dependencies that steam will install for you I think

“If you publish your games through steam there will be an option to add extra dependencies that steam will install for you I think”
That’s useful info, thanks!

No exceptions now it would seem. But when I use mono *.dll on my framework-dependent build or when I run my exe on the self-contained build I get a window that is entirely black.

Are you using mono? Just use the dotnet CLI directly. What happens if you use dotnet run? https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-run

Arial10.spritefont : error : Processor ‘FontDescriptionProcessor’ had unexpected failure!

Not sure I have all the necessary requirements to build from source on Linux, though. I have .Net Core 3.1 installed, though.

Arial is not a linux standard font. You’ll need to google how to install it on your distro. Or pick another font.

@persn Done, thanks! After hours of installing stuff and dealing with errors I got it to work with dotnet run on Linux. But still black screen when I use dotnet *.dll on my framework-dependent build or when I run my .exe on the self-contained build.

Unfortunately I don’t know what the black screen might be

dotnet run works (Debug), but dotnet run --configuration Release gives me a black screen. Figured it out. This was an error within my project where I automatically selected screen resolution to something below native resolution (supported display modes are different on my two PC’s). The debug folder already had an options file with the resolution, so it worked there.

1 Like