Search code examples
c#.netasp.net-mvcnhaml

NHaml configuration problem: Model is not found


I'm having a little problem with my NHaml config:

<configSections>
    <section name="nhaml" type="NHaml.Configuration.NHamlConfigurationSection, NHaml"/>
</configSections>

<nhaml AutoRecompile="true">
  <assemblies>
    <add assembly="Microsoft.Web.Mvc"/>
    <add assembly="MyAssembly"/>
  </assemblies>
  <namespaces>
    <add namespace="NHaml.Web.Mvc"/>
    <add namespace="MyAssembly.Models"/>
    <add namespace="System.Linq"/>
  </namespaces>
</nhaml>

The problem is that I'm trying to use a model from MyAssembly.Models in my view:

%ul
  - foreach(var v in (IQueryable<Model>)ViewData["stat"])
    %li= v.name

But it keeps crashing, telling me that MyAssembly.Models.Model is not recognized, and asking me if I'm lacking a using directive. Is there anything wrong in my web.config or my view?

Thanks in advance.


Solution

  • I have not used NHaml since it was part of MvcContrib, but back then I had my own models working by specifing the complete assembly name in the config eg:

    MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null