3

有没有办法在 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 
4

1 回答 1

0

TL/DR:更新到 Mono 3.x。

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

最近微软终于开源了完整的堆栈,Mono 已经将它包含在他们的树中,但是这发生在 2.10 发布之后并且不会被向后移植。

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

于 2012-11-25T20:52:28.830 回答