我正在尝试使用Mono在RHEL 6上运行exe。我编译了Mono 4.0.2.4,当我尝试运行我的exe时崩溃。
我的命令:
/opt/mono/bin/mono /opt/mono/lib/mono/4.5/mono-service.exe -l:plexos.lock ./DALicenseServer.exe
错误。
Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies.
File name: 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies.
File name: 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
我想我有Mono.Posix.dll文件:
ls /opt/mono/lib/mono/4.0/Mono.Posix.dll
/opt/mono/lib/mono/4.0/Mono.Posix.dll
答案 0 :(得分:1)
这是Xamarin团队目前正在跟踪的错误(错误56787)。您必须在您的环境中下载并粘贴丢失的dll,然后重新启动visual studio。
for vs 2015粘贴这里的dll: C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ Extensions \ Xamarin \ Xamarin \
for vs 2017粘贴到这里的dll: C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Community \ Common7 \ IDE \ Extensions \ Xamarin.VisualStudio
答案 1 :(得分:0)
1)尝试使用跟踪模式运行mono以查看它是否真的是Mono.Posix.dll
或未找到的本机共享库(.so)。
mono --trace /opt/mono/lib/mono/4.5/mono-service.exe -l:plexos.lock ./DALicenseServer.exe
2)检查GAC中是否正确安装了组件:
gacutil -l Mono.Posix
The following assemblies are installed into the GAC:
Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756
Number of items = 1
3)如果在GAC中找不到程序集,则在安装期间出现问题(make install
),因为此程序集是框架安装的一部分。您可以手动分配MONO_PATH以告诉mono
它应该在哪里找到不在当前目录($ PWD)中和/或不在GAC中的程序集:
export MONO_PATH=/path/to/assemblies:/another/path/to/assemblies:$PATH