将 MVC Futures 集成到 Spark 视图引擎中而不杀死 IntelliSense

发布于 2024-07-26 09:36:32 字数 1389 浏览 4 评论 0 原文

我想将 MVC future 添加到我的项目中,并使程序集在我的 Spark 视图中可用。 但无论如何它都不接受。

我可以从我的类(控制器/模型, 等),但它们只是没有出现在 .spark 文件中。

我无法使用 因为这会杀死我的 IntelliSense。 和 如果我尝试添加

我也无法在 web.config Spark 部分添加程序集,因为这会杀死 智能感知也是如此。

这:

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 也设置为“复制本地”到正在运行的 bin。

我在忽略什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年已逝 2024-08-02 09:36:33

嗯,我不知道它是否会解决你的问题,但这是我的 web.config 与 Spark 部分:

<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 get 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 attempts to add the namespaces in web.config 火花部分,但它杀死了智能感知。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文