I'm using Mono's mcs on Ubuntu. I have a Monogame program that has to locate the Monogame libraries in a subdirectory called "libs". It compiles fine, but when it comes to runtime it gives me an error saying it can't find it.
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'MonoGame.Framework, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. File name: 'MonoGame.Framework, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null' [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'MonoGame.Framework, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. File name: 'MonoGame.Framework, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null'
My compiler flags are as follows:
mcs -r:libs/MonoGame.Framework.dll -target:winexe -out:main.exe *.cs
Not even a warning from the compiler, but it can't run. I've tried a lot of variations of these flags and I can't find an option to static compile (and I don't really want to). It runs fine when the libraries are in the same directory, but in a subdirectory it doesn't work. I've tried supposed solutions such as "AppDomain.CurrentDomain" and "Environment.SetEnvironmentVariable" but that didn't work and honestly it's a bad idea.