Saturday, July 21, 2007

Solved! "exePath must be specified when not running inside a stand alone exe" Embedding Mono

Currently i'm Embedding Mono in XChat, but it was giving me errors trying to get values from Configuration File System.ArgumentException: exePath must be specified when not running inside a stand alone exe. at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] The Solution is simple: pass the assembly path to mono exec in the first argument for the function mono_jit_exec. char * boot_assembly = "myAssembly.exe" ... MonoDomain * dom = mono_jit_init(boot_assembly); MonoAssembly * masm = mono_domain_assembly_open(dom,boot_assembly); char *argv [1]; [0] = boot_assembly; [1] = NULL; mono_jit_exec (dom, masm, 1,argv);

No comments: