无法设置asp.net MVC 2 RC和火花视图引擎 [英] Can't set up asp.net mvc 2 RC and spark view engine

查看:172
本文介绍了无法设置asp.net MVC 2 RC和火花视图引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否omebody有想法如何解决未找到方法:'太虚System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext,System.Web.Mvc.IView,System.Web.Mvc。的ViewDataDictionary,System.Web.Mvc.TempDataDictionary)'。例外。此解决方案不起作用<一个href=\"http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-$p$pview-2.aspx\" rel=\"nofollow\">http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-$p$pview-2.aspx.

Does omebody has ideas how to fix "Method not found: 'Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary)'." exception. This solution doesn't work http://dotnetslackers.com/articles/aspnet/installing-the-spark-view-engine-into-asp-net-mvc-2-preview-2.aspx.

Thans所有。

推荐答案

我不得不下载火花视图引擎源$ C ​​$ C(的http://sparkviewengine.$c$cplex.com/Release/ProjectReleases.aspx?ReleaseId=27600).有一次,我这样做,我通过每一个不得不将1.0版本System.Web.Mvc组件的参考和更新,以引用指向System.Web.Mvc 2.0项目去了。在那里,您可以构建解决方案(在Visual工作室),你会发现,测试一大堆启动失败。你可以尝试解决这些问题(通过添加额外的TextWriter参数,你会发现现在需要的),你也将看到SparkView.cs文件说有。缺少参数在Render方法(来源$ C ​​$ C我下载的第100行)我不得不更新wrappedViewContext的实例看起来像这样(添加作家的参数列表的末尾):

I had to download the spark view engine source code (http://sparkviewengine.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27600). Once I did that I went through each of the projects that had a reference to the 1.0 version of System.Web.Mvc assembly and updated to reference to point to System.Web.Mvc 2.0. From there you can build the solution (in visual studio) and you will find that a whole bunch of tests start to fail. You can attempt to fix them (by adding the additional TextWriter parameter you will find is now needed). You will also see that the SparkView.cs file complains about a missing parameter. In the Render method (line 100 of the source code I downloaded) I had to update the instantiation of the wrappedViewContext to look like this (add writer to the end of the list of parameters):

public void Render(ViewContext viewContext, TextWriter writer)
{
    var wrappedHttpContext = new HttpContextWrapper(viewContext.HttpContext, this);

    var wrappedViewContext = new ViewContext(
        new ControllerContext(wrappedHttpContext, viewContext.RouteData, viewContext.Controller),
        viewContext.View,
        viewContext.ViewData,
        viewContext.TempData,
        writer); //  <-- add the writer to the end of the list of parameters

    ...
}

一旦code更新可以运行build.cmd脚本,在您下载源的根。构建过程将创建在build / DIST文件夹中的zip文件。采取这些新的动态链接库,并将其添加到您的网站。事情应该再次工作。

Once the code is updated you can run the build.cmd script that is in the root of the source you downloaded. The build process will create a zip file in the build/dist folder. Take those new dll's and add them to your website. Things should work once again.

这篇关于无法设置asp.net MVC 2 RC和火花视图引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆