在我们的 Web 项目中,我们在文件夹 \Code\Extensions\DateTimeExtension.cs 中添加了扩展方法,其中包含一个名为 FromUtcToUserTimeZone() 的扩展方法
我们在 asp.net mvc 中使用 spark 视图引擎,并希望它在那里以中等信任度工作,因为我们需要对视图进行预编译。
当构建后事件运行时,我收到错误 29 'System.DateTime' does not contain a definition for 'FromUtcToUserTimeZone' c:...\Views\Calendar\Index.spark' 我已添加到我的视图中。
将自己的 webproject 添加到 web.config
<spark>
<compilation debug="false" >
<assemblies>
<add assembly="System.Web.Mvc" />
<add assembly="....Models" />
<add assembly="...Web" />
</assemblies>
</compilation>
<pages automaticEncoding="true"/>
它仍然无法正常工作。