Spark and MvcContrib and the 'The type or namespace name 'FluentHtml' does not exist' error

By Deathraven on Monday 30 August 2010 12:17 - Comments (1)
Category: MVC, Views: 5.766

So its been a while since my last post. The past year getting my .Net 3.5 and WCF certification and switching to a new job have kept me rather busy. But perhaps more on that in a different post.

Lately I have been busy with asp.net mvc and my favourite viewengine Spark.
However it seems there is a problem in the spark compiler. Whenever
the app pool recycles, the spark compiler doesn't seem to load all of
the referenced assemblies, resulting in compilation errors.



You will probably encounter this error when using the MvcContrib or MvcContrib.FluentHtml libraries since those are often only referenced in your views.

This problem often exposes itself in the exception:

The type or namespace name 'FluentHtml' does not exist in the namespace 'MvcContrib' (are you missing an assembly reference?)

It took me a while before i figured out what was going on. Long story short: Add the assembly references to your spark configuration like so:


XML:
1
2
3
4
5
6
7
<spark>
    <compilation debug="true" defaultLanguage="CSharp">
      <assemblies>
        <add assembly="Microsoft.Web.Mvc" />
        <add assembly="MvcContrib" />
        <add assembly="MvcContrib.FluentHtml"/>
..

Volgende: Extending MVC Contrib MenuBuilder 09-'10 Extending MVC Contrib MenuBuilder
Volgende: Request Response ServiceLayer 12-'09 Request Response ServiceLayer

Comments


By Elena, Monday 22 July 2013 05:00

Free knowledge like this doesn't just help, it promote demycraco. Thank you.

Comments are closed