我尝试编译剃刀文件,该行RazorEngine解析抛出无法编译
RazorEngine.Razor.Parse("Hello world");
,但它只是抛出
base {System.Exception} = {"Unable to compile template. Source file 'C:\\Windows\\TEMP\\vlu4zahf.0.cs' could not be found\n\nOther compilation errors may have occurred. Check the Errors property for more information."}
和错误性质是这样的:
[0] = {error CS2001: Source file 'C:\Windows\TEMP\vlu4zahf.0.cs' could not be found}
[1] = {warning CS2008: No source files specified}
所以没有好的信息。
我运行.NET 4.0和剃刀引擎3.2.0.0
更新1
我已经找到错误该线路RazorEngine
Tuple.Create(
compileResult.CompiledAssembly.GetType("CompiledRazorTemplates.Dynamic." + context.ClassName),
compileResult.CompiledAssembly);
请检查http://stackoverflow.com/questions/6444277/using-razorengine-to-parse-razor:
这也可以在PowerShell中完成运行以下(以管理员身份运行) -templates-同时 – Amit 2013-04-04 08:37:11
@AmitAgrawal谢谢,但这篇文章是关于线程安全性的。我现在只有一个线程处于活动状态。 – 2013-04-04 08:41:04