有没有办法在Mono v2.10上使用RazorEngine v3?

尝试解析模板时收到以下错误。

TypeLoadException: A type load exception has occurred.
  at RazorEngine.Templating.TemplateService.CreateTemplateType (System.String razorTemplate, System.Type modelType) [0x00000] in <filename unknown>:0
  at RazorEngine.Templating.TemplateService.CreateTemplate[<>f__AnonymousType0`2] (System.String razorTemplate, .<>f__AnonymousType0`2 model) [0x00000] in <filename unknown>:0
  at RazorEngine.Templating.TemplateService.Parse[<>f__AnonymousType0`2] (System.String razorTemplate, .<>f__AnonymousType0`2 model) [0x00000] in <filename unknown>:0
  at RazorEngine.Razor.Parse[<>f__AnonymousType0`2] (System.String razorTemplate, .<>f__AnonymousType0`2 model) [0x00000] in <filename unknown>:0

最佳答案

TL / DR:更新到Mono3.x。

长话短说:在发布Mono 2.10.x时,Microsoft尚未完全以开放源代码的形式发布ASP.NET堆栈(Razor是仍是封闭源代码的组件之一)。

最近,Microsoft终于将完整的堆栈开源了,Mono已将其包含在其树中,但是这是在2.10版本发布之后发生的,因此不会回迁。

更长的故事:http://tirania.org/blog/archive/2012/Mar-28.html

关于.net - 在Mono v2.10上使用RazorEngine v3,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12115664/

10-10 08:29