-1

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:

enter image description here

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.

Onion
  • 21
  • 1
  • 6

1 Answers1

-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.

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76
Raju Paladiya
  • 778
  • 2
  • 12
  • 35
  • 1
    Nop.Web.Framework.Mvc.Razor & the _ViewImports.cshtml do not exist on my version of nopcommerce. (using v3.9) – Onion Jan 20 '20 at 08:05
  • I did try ```@using Nop.Web.Framework.ViewEngines.Razor;``` but it didn't work – Onion Jan 20 '20 at 08:27
  • @Onion - You still getting same error message or different one?. – Raju Paladiya Jan 21 '20 at 08:52
  • Tbh trying to fix that error I'm now getting a weird assembly load issue: https://www.nopcommerce.com/boards/topic/75401/error-on-project-run-plugin-assembly-could-not-be-loaded-systembadimage-exception – Onion Jan 28 '20 at 11:53
  • I just reverted to an old commit for now so ye this thread is still about the same issue. – Onion Jan 28 '20 at 13:08
  • I got the same error message after adding @using Nop.Web.Framework.Mvc.Razor to the view page. – Kyllian Mobley Nov 12 '21 at 18:04