views:

146

answers:

2

Hello. 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.

A: 

Gonzalo

Unfortunately it is not enough information to diagnose. Is it possible for you to create a sanitized copy of your code and create a new issue on the nhaml site (http://code.google.com/p/nhaml/issues/entry) with the zipped solution attached?

After I have a look into it I will post the solution back here.

Simon
I'm now at work. When I get back home, I'll try Brendan Kowitz's solution first and, if that doesn't work, I'll do this. Thank you ;)
Gonzalo Quero
+2  A: 

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
Brendan Kowitz
That was it, thank you very much ;)
Gonzalo Quero