T4MVC renderpartial 和 Spark 视图

发布于 2024-08-18 04:59:14 字数 823 浏览 6 评论 0原文

 #Html.RenderPartial(MVC.Shared.Views._Sorter);

抛出错误=>

没有为扩展名“.spark”注册的构建提供程序。您可以在 machine.config 或 web.config 的部分中注册一个。确保具有 BuildProviderAppliesToAttribute 属性,其中包含值“Web”或“All”。

描述:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。

异常详细信息:System.Web.HttpException:没有为扩展名“.spark”注册构建提供程序。您可以在 machine.config 或 web.config 的部分中注册一个。确保具有 BuildProviderAppliesToAttribute 属性,其中包含值“Web”或“All”。

有什么想法可能是错的吗?


将其添加到 web.config=>system.web=>compilation

  <buildProviders>
    <add extension=".spark" type="System.Web.Compilation.PageBuildProvider" />
  </buildProviders>

强制应用程序将 Spark 视图构建为 Webforms 视图,并生成 ${Something.something} 。那么 - Spark ViewEngine 的等价物是什么?

 #Html.RenderPartial(MVC.Shared.Views._Sorter);

throws error =>

There is no build provider registered for the extension '.spark'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: There is no build provider registered for the extension '.spark'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.

Any ideas what might be wrong?


Adding this to web.config=>system.web=>compilation

  <buildProviders>
    <add extension=".spark" type="System.Web.Compilation.PageBuildProvider" />
  </buildProviders>

Forces app to build spark view as webforms view and produces ${Something.something} all around. So - what's an equivalent for spark viewengine?

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

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

发布评论

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

评论(1

无尽的现实 2024-08-25 04:59:14

您能否尝试对 T4MVT.tt 进行以下更改。在方法 ViewsFolderInfo.AddView 中,将行:更改

Views[viewFieldName] = GetVirtualPath(item);

Views[viewFieldName] = viewFieldName;

如果效果良好,我们只需向设置文件添加一个开关即可使其执行此操作,而不是使用默认的完整路径。

让我知道进展如何!


请注意,MVC.Shared.Views._Sorter 只是一个带有视图路径的常量。如果您要在没有 T4MVC 的情况下编写此代码,您会在其中传递什么确切的字符串?

也许 Spark 在这里接受的视图路径类型有不同的要求?如果需要,我们可以调整 T4MVC 来完成这项工作,但我想首先完全了解 T4MVC 之外的 Spark 行为。

Can you please try to make the following change to T4MVT.tt. In the method ViewsFolderInfo.AddView, change the line:

Views[viewFieldName] = GetVirtualPath(item);

to

Views[viewFieldName] = viewFieldName;

If that works well, we can just add a switch to the settings file that makes it do this instead of the default full path.

Let me know how that goes!


Note that MVC.Shared.Views._Sorter is just a constant with the path to the view. If you were to write this code without T4MVC, what exact string would you pass in there?

Maybe Spark has different requirements in the type of view paths it accepts here? If needed, we can tweak T4MVC to make this work, but I'd like to fully understand the Spark behavior outside of T4MVC first.

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