Firstly, I've seen this question, and while the problem seems similar, it is not the same.
I'm running a trimmed down mono, built without the 4.5 profile using ./configure --with-profile4=yes --with-profile4_5=no
.
I have an application that targets .NET 4.0, built using mono's xbuild
. When I run it against my trimmed down mono installation, I get this error:
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/opt/my-app/mono/lib/mono/4.5/mscorlib.dll' directory.
Now, I'm not referencing only 4.0 assemblies - nothing from 4.5, AFAICS.
Why might I be getting this error?
I'm not sure if it's related, but I get this warning when building with xbuild
(but not when building with msbuild
, although I still get the mscorlib.dll
when running against my trimmed down mono):
warning CS1685: The predefined type `System.Runtime.CompilerServices.ExtensionAttribute' is defined multiple times.
Using definition from `mscorlib.dll'
I'm also not sure if this is relevant either, but the build machine does has .NET 4.5 installed.
I figured it out - I needed to set MONO_PATH to:
/opt/my-app/mono/lib/mono/4.0:/opt/my-app/mono/lib/mono/3.5:/opt/my-app/mono/lib/mono/2.0:.
So I needed to tell it where to look for libraries; I had (wrongly) assumed that would be automatic based on the location of the mono executable.
来源:https://stackoverflow.com/questions/23626577/the-assembly-mscorlib-dll-was-not-found-or-could-not-be-loaded