The name 'T' does not exist in the current context while overriding view in a nopCommerce plugin

不羁岁月 提交于 2020-01-25 09:27:06

问题


First, for context, I'm working on a Plugin for nopCommerce.

I am overriding a view (namely \Presentation\Nop.Web\Administration\Views\Currency\List.cshtml) in my plugin by creating a custom view engine. Now though that's successful, I'm having trouble loading my customized view.

One of probably several errors when app tries to load my view:

Apparently not very experienced with front-end so subsequently with how views work.

Edit: Created View doesn't recognize sln project references to better localize the issue.


回答1:


From the error message, it seems that the namespace reference is missing for the localization.

To resolve this error, you need to add a reference @using Nop.Web.Framework.Mvc.Razor in your overridden view page.

Another way is to add the reference to _ViewImports.cshtml file under your plugin > views folder.

A better way is to copy _ViewImports.cshtml file from \Presentation\Nop.Web\Areas\Admin\Views\_ViewImports.cshtml and paste it to your plugin > Views Folder

This will resolve the error you're facing.



来源:https://stackoverflow.com/questions/59790386/the-name-t-does-not-exist-in-the-current-context-while-overriding-view-in-a-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!