该组件mscorlib.dll中未找到或无法加载组件、中未、加载、dll

2023-09-03 03:05:03 作者:朋友以上,恋人未满

首先,我已经看到了this问题和而这个问题似乎相似,它是不一样的。

Firstly, I've seen this question, and while the problem seems similar, it is not the same.

我用运行下调单声道,没有内置的4.5轮廓./配置--with-profile4 = YES --with-profile4_5 =没有

我有一个面向.NET 4.0的应用程序,使用单声道的内置 xbuild 。当我运行这对我的下调单的安装,我得到这个错误:

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:

该组件mscorlib.dll中未找到或无法加载。 它应该已经安装在`/opt/my-app/mono/lib/mono/4.5/mscorlib.dll目录。

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.

现在,我不是只引用4.0组件 - 从4.5一无所有,AFAICS

Now, I'm not referencing only 4.0 assemblies - nothing from 4.5, AFAICS.

为什么会我会得到这个错误?

Why might I be getting this error?

我不知道,如果是相关的,但我与 xbuild 建筑时(但不与的MSBuild ,但我仍然得到 mscorlib.dll中对我的下调单运行)时:

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' 

我也不知道这是相关下去,但构建机确实具有.NET 4.5安装。

I'm also not sure if this is relevant either, but the build machine does has .NET 4.5 installed.

推荐答案

我想它了 - 我需要设置MONO_PATH为:

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.