Mono - Could not load file or assembly

10,588

Solution 1

I had the same problem with a dll that was in the same path as the application assembly, the problem was that the dll name had a different case than the expected one. So the Abc.dll was missing, in the folder it was named abc.dll, after renaming, it worked.

Solution 2

I guess I'm going to ask the obvious:

Do you have Centrism.Core.dll somewhere that Mono knows about and can get to?

Solution 3

If your project is referencing the Centrism.Administration.UI.dll, and it is not in the GAC on your iMac, the easiest solution would probably be to set the reference to that assembly to "Local Copy". For web projects, this will copy the assembly into the application's Bin directory, where xsp should be able to pick it up.

Solution 4

I had this error when adding a new assembly to an existing project (which itself was referenced by a unit test project).

Because the assembly wasn't included in both projects, the unit test would error out. The solution was to add a Copy tag to the project file:

<Copy SourceFiles="$(ProjectDir)\dlls\NewAssembly.dll" DestinationFolder="$(OutputPath)" SkipUnchangedFiles="true" />

Presumably it would also work to add the reference directly to the unit test (this reference is not used directly, so was able to avoid using above).

Share:
10,588
nhu
Author by

nhu

Updated on June 04, 2022

Comments

  • nhu
    nhu almost 2 years

    i just exported my project to my new imac an loaded my solution into monodevelop. After the successfully compilation i started the project, and i always getting the same error.

    ** (/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/2.0/xsp2.exe:1576): WARNING **: The following assembly referenced from /private/var/folders/9y/9ypfv24bEwieHw+Yy+PUsU+++TI/-Tmp-/nhu-temp-aspnet-0/ebc9e2c6/assembly/shadow/7f5f6265/859daf16_fac2cd73_00000001/Centrism.Administration.UI.dll could not be loaded: Assembly: Centrism.Core (assemblyref_index=3) Version: 0.0.3688.40278 Public Key: (none) The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/var/folders/9y/9ypfv24bEwieHw+Yy+PUsU+++TI/-Tmp-/nhu-temp-aspnet-0/ebc9e2c6/assembly/shadow/7f5f6265/859daf16_fac2cd73_00000001/).

    ** (/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/2.0/xsp2.exe:1576): WARNING **: Could not load file or assembly 'Centrism.Core, Version=0.0.3688.40278, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

    In other projects the assembly works correct and can be loaded.

  • nhu
    nhu about 14 years
    Hi and thanks for your answer. It is normal include to the project solution. But I also set the MONO_PATH var to a global path where I compile my assemblies to. But it doesn't run anyway.
  • jpobst
    jpobst about 14 years
    If you add the following environment variables, it should produce a lot more info about where Mono is trying to load from: MONO_LOG_LEVEL="debug" MONO_LOG_MASK="dll".