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
基础教程推荐
- 将数据集转换为列表 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 如果条件可以为空 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
