【问题标题】:Integrating MVC Futures in Spark view engine without killing IntelliSense在 Spark 视图引擎中集成 MVC Futures 而不会杀死 IntelliSense
【发布时间】:2009-07-13 22:30:26
【问题描述】:

我想将 MVC 期货添加到我的项目中,并使程序集在我的 Spark 视图中可用。但是它不接受它。

我可以在我的课程中很好地使用 Microsoft.Web.Mvc(控制器/模型, 等),但它们只是没有出现在 .spark 文件中。

我不能使用<use assembly""/>,因为这会杀死我的 IntelliSense。和 如果我尝试添加 <use namespace='Microsoft.Web.Mvc" /> 它不是 找到.Web

我也无法在 web.config spark 部分添加程序集,因为这会杀死 IntelliSense 也是如此。

这个:

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));
}

不会引发错误,也不会杀死我在 Sspark 文件中的 IntelliSense,但是 它似乎也不想导入程序集。

Microsoft.Web.Mvc.dll 也设置为 Copy Local to the running bin。

我忽略了什么?

【问题讨论】:

  • 我为此开了一个赏金,因为 ASP.net 视图引擎让我越来越生气:)。

标签: asp.net-mvc spark-view-engine asp.net-mvc-futures


【解决方案1】:

嗯,我不知道它是否能解决您的问题,但这是我的带有 Spark 部分的 web.config:

<spark>
    <compilation debug="true"/>
    <pages automaticEncoding="true" pageBaseType="xx.Web.SparkModelViewPage"/>
</spark>

pageBaseType 是为了支持来自 MvcContrib 的 Fluent HTML

在 _Global.spark 文件中我得到了这个:

<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"/>

我尝试在 web.config spark 部分添加命名空间,但它会杀死智能感知。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多