我试图在mono中使用Gnu.Getopt。根据其他类似问题的答案,我已经做了以下操作:
% gacutil -i .../gnu.getopt.net-0.9.1/Gnu.Getopt/bin/Release/Gnu.Getopt.dll
可行的方案:
% gacutil -l | grep Gnu.Getopt
Gnu.Getopt, Version=0.9.1.24287, Culture=neutral, PublicKeyToken=d014b4ccdc53511a
但是 Mono 找不到它:
% grep Gnu Program.cs
using Gnu.Getopt;
% mcs Program.cs
Program.cs(4,7): error CS0246: The type or namespace name `Gnu' could not be found. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
将DLL的显式路径传递给程序可以正常运行:
% mcs -r:.../gnu.getopt.net-0.9.1/Gnu.Getopt/bin/Release/Gnu.Getopt.dll Program.cs
%
我错过了什么?
更新
我注意到 /usr/lib/mono/4.5
中的符号链接指向 /usr/lib/mono/gac
中的所有内容(例如 System.Core.dll
-> ../gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
)。我插入了对 Gnu.Getopt.dll
的符号链接,但症状仍然存在。