问题
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