[Mono-dev] Setting the assembly location(complete)

Thiago Padilha tpadilha84 at gmail.com
Mon Jun 14 14:46:05 EDT 2010


I have a very simple C program that links against mono, heres part of the code :
//
       MonoDomain *domain;
       char *file = "ManagedAssembly.exe";

       char* exePath = getexedir(); //method that returns the exe directory

       mono_set_dirs (exePath, exePath);


       mono_config_parse (NULL);

       domain = mono_jit_init (file);


       MonoAssembly *assembly;

       assembly = mono_domain_assembly_open (domain, file);
       if (!assembly)
               exit (2);
       /*
        * mono_jit_exec() will run the Main() method in the assembly.
        * The return value needs to be looked up from
        * System.Environment.ExitCode.
        */

       mono_jit_exec (domain, assembly, argc, argv);
//
  This was working fine, some some days ago I made a modification and
when I tried to run the following message appears :

The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the
`/home/thiago/Projects/Worklight/Work/linux/bin/mono/1.0/mscorlib.dll'
directory.

   The first time I tried to set the mono dirs, the path was :
`/home/thiago/Projects/Worklight/Work/linux/bin/mono/2.0/mscorlib.dll'
.

Which I have installed correctly, I don't know why it is asking for
1.0 version of mscorlib.dll, but I would like to have control over
that. In this case the C program is installed in
/home/thiago/Projects/Worklight/Work/linux/bin/ and it looks for
mscolib in the mono/2.0 subfolder, can I have control over which
subfolders mono looks for assemblies?


More information about the Mono-devel-list mailing list