我在Linux机器上运行Mono 3.3.0。 我正在尝试使用RazorEngine 3.3.0(来自NuGet)。
不幸的是它现在抛出了这个异常
System.Exception:无法编译模板。预定义类型
System.Collections.Generic.IReadOnlyList' is defined multiple times. Using definition from
mscorlib.dll中“
但是,我的Windows机器上的代码运行正常。 我是否遗漏了一些明显的东西,或者这根本不适用于Mono?
[编辑]
我刚刚在异常的“错误”属性中找到了此信息。
{'Line':'0','Column':'0','ErrorNumber':'CS1685','IsWarning': 'True','ErrorText':'预定义类型
System.Collections.Generic.IReadOnlyList' is defined multiple times. Using definition from
mscorlib.dll'','文件名':''} {'线':'0', '列':'0','ErrorNumber':'','IsWarning':'False','ErrorText': '/usr/lib/mono/4.5/mscorlib.dll(符号相关的位置 先前的警告)',''Filename':''} {'Line':'0','Column':'0', 'ErrorNumber':'','IsWarning':'False','ErrorText': “/usr/lib/mono/gac/fastcgi-mono-server4/3.0.0.0_0738eb9f132ed756/fastcgi-mono-server4.exe (与先前警告相关的符号的位置)','文件名':''} {'Line':'0','Column':'0','ErrorNumber':'CS1685','IsWarning': 'True','ErrorText':'预定义类型System.Collections.Generic.IReadOnlyCollection' is defined multiple times. Using definition from
mscorlib.dll'','文件名':''} {'Line':'0','Column':'0','ErrorNumber':'','IsWarning':'False', 'ErrorText':'/ usr / lib / mono /4.5 / mscorlib.dll(符号的位置) 与之前的警告相关)','文件名':''} {'线':'0', '列':'0','ErrorNumber':'','IsWarning':'False','ErrorText': “/usr/lib/mono/gac/fastcgi-mono-server4/3.0.0.0_0738eb9f132ed756/fastcgi-mono-server4.exe (与先前警告相关的符号的位置)','文件名':''}
答案 0 :(得分:0)
我发现了https://askubuntu.com/questions/315713/trouble-compiling-monodevelop-4-on-ubuntu-12-04
它让我想到我是如何安装Mono的。我从gz文件安装,然后从Git安装(获取最新版本),最终给了我两份副本。不幸的是我无法直接从Git安装(因为它需要安装Mono才能构建......)。所以我只是转向gz,问题自动解决了!
所以基本上,两个Mono实例同时存在(不知何故),而RazorEngine是第一个向我指出的事情(但其他一切工作都很好)。
答案 1 :(得分:0)
如果您只安装一个Mono,请查看我在此处描述的解决方案: Razor Engine on Mono 3.2.x with Fast CGI - target specific .net?