{"id":2984,"date":"2010-01-31T14:41:00","date_gmt":"2010-01-31T14:41:00","guid":{"rendered":"https:\/\/test.simple-talk.com\/uncategorized\/getting-spark-view-engine-to-work-with-asp-net-mvc\/"},"modified":"2016-07-28T10:49:52","modified_gmt":"2016-07-28T10:49:52","slug":"getting-spark-view-engine-to-work-with-asp-net-mvc","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/getting-spark-view-engine-to-work-with-asp-net-mvc\/","title":{"rendered":"Getting Spark View Engine to work with ASP.NET MVC"},"content":{"rendered":"<p>Method not found: &#8216;Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary)&#8217;<\/p>\n<p>I am finding that there are several complaints about getting Spark View Engine to work with ASP.NET MVC.&#160; I had to tweak the Spark View Engine code base to get things running again.<\/p>\n<p>I had to download the spark view engine source code (<a href=\"http:\/\/sparkviewengine.codeplex.com\/Release\/ProjectReleases.aspx?ReleaseId=27600\">http:\/\/sparkviewengine.codeplex.com\/Release\/ProjectReleases.aspx?ReleaseId=27600<\/a>).&#160; 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.&#160; From there you can build the solution (in visual studio) and you will find that a whole bunch of tests start to fail.&#160; You can attempt to fix them (by adding the additional TextWriter parameter you will find is now needed).&#160; You will also see that the SparkView.cs file complains about a missing parameter.&#160; 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): <\/p>\n<p>&#160;&#160;&#160; public void Render(ViewContext viewContext, TextWriter writer)    <br \/>&#160;&#160;&#160; {     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; var wrappedHttpContext = new HttpContextWrapper(viewContext.HttpContext, this);     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; var wrappedViewContext = new ViewContext(     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new ControllerContext(wrappedHttpContext, viewContext.RouteData, viewContext.Controller),     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewContext.View,     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewContext.ViewData,     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewContext.TempData,     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; writer); \/\/&#160; &lt;&#8211; add the writer to the end of the list of parameters     <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8230;     <br \/>&#160;&#160;&#160; } <\/p>\n<p>Once the code is updated you can run the build.cmd script that is in the root of the source you downloaded.&#160; The build process will create a zip file in the build\/dist folder.&#160; Take those new dll&#8217;s and add them to your website.&#160; Things should work once again. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Method not found: &#8216;Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary)&#8217; I am finding that there are several complaints about getting Spark View Engine to work with ASP.NET MVC.&#160; I had to tweak the Spark View Engine code base to get things running again. I had to download the spark view engine source code (http:\/\/sparkviewengine.codeplex.com\/Release\/ProjectReleases.aspx?ReleaseId=27600).&#160; Once I did&#8230;&hellip;<\/p>\n","protected":false},"author":13980,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[],"class_list":["post-2984","post","type-post","status-publish","format-standard","hentry","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/13980"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=2984"}],"version-history":[{"count":2,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2984\/revisions"}],"predecessor-version":[{"id":41849,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/2984\/revisions\/41849"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=2984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=2984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=2984"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=2984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}