The assembly mscorlib.dll was not found or could not be loaded(未找到或无法加载程序集 mscorlib.dll)
问题描述
首先,我看到 this question,虽然问题看起来很相似,但其实不一样.
Firstly, I've seen this question, and while the problem seems similar, it is not the same.
我正在运行一个精简的单声道,使用 ./configure --with-profile4=yes --with-profile4_5=no 在没有 4.5 配置文件的情况下构建.
I'm running a trimmed down mono, built without the 4.5 profile using ./configure --with-profile4=yes --with-profile4_5=no.
我有一个针对 .NET 4.0 的应用程序,使用 mono 的 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' 目录中.
现在,我不仅仅引用 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.
这篇关于未找到或无法加载程序集 mscorlib.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:未找到或无法加载程序集 mscorlib.dll
基础教程推荐
- C# 从 List<List<int>> 中删除重 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- WPF 模态进度窗口 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
