I want to add MVC futures to my project and make the assembly available in my Spark views. However it's not accepting it whatsoever.
I can use Microsoft.Web.Mvc fine from my classes (controllers/models, etc.), but they're just not showing up in .spark files.
I cannot use <use assembly""/>
since that kills my IntelliSense. And
if I try to add <use namespace='Microsoft.Web.Mvc" />
it's not
finding .Web
.
I also can't add assemblies in the web.config
spark section as that kills
IntelliSense too.
This:
public void RegisterViewEngines(ViewEngineCollection engines)
{
if (engines == null) throw new ArgumentNullException("engines");
var settings = new SparkSettings();
settings.SetAutomaticEncoding(true);
settings
.AddNamespace("System")
.AddNamespace("System.Collections.Generic")
.AddNamespace("System.Linq")
.AddNamespace("System.Web.Mvc")
.AddNamespace("System.Web.Mvc.Html")
.AddNamespace("Microsoft.Web.Mvc");
settings
.AddAssembly("Microsoft.Web.Mvc")
.AddAssembly("Spark.Web.Mvc")
.AddAssembly("System.Web.Mvc, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35")
.AddAssembly("System.Web.Routing, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35");
engines.Add(new SparkViewFactory(settings));
}
Throws no errors and doesn't kill my IntelliSense in Sspark files, but it also doesn't seem to want to import the assembly even still.
The Microsoft.Web.Mvc.dll is set to Copy Local to the running bin too.
What am I overlooking?
Hum I don't know if it will resolve your problem but here is my web.config with the Spark section :
<spark>
<compilation debug="true"/>
<pages automaticEncoding="true" pageBaseType="xx.Web.SparkModelViewPage"/>
</spark>
pageBaseType is to support Fluent HTML from MvcContrib
and in the _Global.spark file I got this :
<use namespace="System"/>
<use namespace="System.Linq"/>
<use namespace="System.Web.Mvc"/>
<use namespace="System.Web.Mvc.Html"/>
<use namespace="System.Web.Routing"/>
<use namespace="System.Collections.Generic"/>
<use namespace="xxx.Web"/>
<use namespace="MvcContrib"/>
<use namespace="MvcContrib.UI"/>
<use namespace="MvcContrib.UI.Grid"/>
<use namespace="MvcContrib.UI.Pager"/>
<use namespace="MvcContrib.UI.Grid.ActionSyntax"/>
<use namespace="MvcContrib.FluentHtml"/>
<use namespace="MvcContrib.FluentHtml.Elements"/>
<use namespace="Microsoft.Web.Mvc"/>
<use namespace="Microsoft.Web.Mvc.Controls"/>
<use namespace="xVal.Html"/>
I tried to add the namespaces in web.config spark section but it kills intellisense.