ServiceStack Razor Views编译错误

时间:2013-10-14 17:59:24

标签: c# razor servicestack

好的我一直在看Razor Rockstars,但我创建了一个描述Physical Project Structure

的布局

我在ServiceInterface dll中有一个视图,并且每次浏览到localhost时都将它设置为CopyIfNewer:5000 \ hello \ name我收到以下错误:

HttpCompileException

它说:

c:\Users\tyler.w.reid\AppData\Local\Temp\ayyw2jf2.0.cs(28): error CS0246: The type or namespace name 'ServiceModel' could not be found (are you missing a using directive or an assembly reference?)

我确保主exe和ServiceInterface dll都有对该项目的引用。我还将它添加到了app.config

<pages pageBaseType="ServiceStack.Razor.ViewPage">
        <namespaces>
            <add namespace="ServiceStack.Html" />
            <add namespace="ServiceStack.Razor" />
            <add namespace="ServiceStack.Text" />
            <add namespace="ServiceStack.OrmLite" />
            <add namespace="StudentTeachingManager" />
            <add namespace="StudentTeachingManager.ServiceModel" />
            <add namespace="StudentTeachingManager.ServiceModel.Types" />
        </namespaces>
    </pages>

有人可以提供一些关于下一步该做什么的建议吗?

1 个答案:

答案 0 :(得分:2)

我最近遇到了一个与此类似的问题:

Razor “The type or namespace name 'x' could not be found” Error. Compile Only

我必须确保在razor编译时不仅仅引用了dll。

尝试使用全局App启动函数从抛出错误的dll中调用任何东西(一个静态方法调用ping,它什么都没用)。