【问题标题】:Nancy doesn't find system.xml南希没有找到 system.xml
【发布时间】:2014-11-19 10:03:14
【问题描述】:

我有一个带有 using 语句的 Nancy 视图:

@using System.Xml
@{ //code
}
<!-- rest of page -->

我的项目中引用了System.Xml。

当我尝试运行应用程序时,我收到 Razor 编译错误:

Error compiling template: Views/index.cshtml

Errors:
[CS0234] Line: 1 Column: 18 - The type or namespace name 'Xml' does not exist in the namespace 'System' (are you missing an assembly reference?) (show)

 Details:
 @using System.Xml

其他命名空间,例如System.Web 也会以同样的方式失败,即使它们包含在项目中。

想法?

【问题讨论】:

    标签: razor nancy


    【解决方案1】:

    这看起来像是不配置剃须刀的经典案例。

    https://github.com/NancyFx/Nancy/wiki/Razor-View-Engine#configuring-razor

    【讨论】:

    • 根据文档配置剃须刀消除了编译时错误。现在我得到一个运行时错误:Nancy.RequestExecutionException: Oh noes! ---> System.IO.FileNotFoundException:无法加载文件或程序集“System.Xml”的想法?谢谢!
    猜你喜欢
    • 2015-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-21
    • 2011-12-29
    相关资源
    最近更新 更多