views:

305

answers:

1

In our web project we have added Extension methods in a folder \Code\Extensions\DateTimeExtension.cs containing an extension method called FromUtcToUserTimeZone()

We use the spark view engine in asp.net mvc and want it to work on medium trust there for we need to make a pre compilation of the views.

When the post build event runs I get Error 29 'System.DateTime' does not contain a definition for 'FromUtcToUserTimeZone' c:...\Views\Calendar\Index.spark' I'v added to my view.

Added the webproject it self to the web.config

<spark> 
<compilation debug="false" > 
  <assemblies> 
    <add assembly="System.Web.Mvc" /> 
    <add assembly="....Models" /> 
    <add assembly="...Web" /> 
  </assemblies> 
</compilation> 
<pages automaticEncoding="true"/>

And its still not working.

+1  A: 

Did you include namespace containing this method in your view?

<use namespace="YourNamespace"/>

You can place this include in _global.spark or your view. If you place it in _global.spark, you will have access to it in every view.

LukLed
I'v added it to my view and _global.spark no luck. Seams that I'm having problems with all external libraries.
Emil C