Views in custom Plugin cannot find 'NopHtml' helper nor the 'T' localizer.
_ViewImports.cshtml is present under Views folder as well the rest of the Views.
The plugin code is actually from the official course.
Note that injecting dependancies directly into the views works.
Version is 4.50.4
Do you have
@inject INopHtmlHelper NopHtml
in your _ViewImports.cshtml file
Are you getting errors when the code runs, or just in Visual Studio's syntax validation?
The plugin is built and appears in the Nop.Web.Plugins folder but there are several problems:
1. At the admin panel the Plugin keeps its "ready to install" state after installation and app restart.
I mean there are no 'Configure' and 'Edit' buttons as well as 'Install' and 'Delete' Buttons remain instead of 'UnInstall'.
2. Localization does not function for the plugin views. Localization keys appear as text instead of the values.
3. No views or components of the plugin appear in the Admin section.
Are you running the 'published' version, or are you running in Visual Studio?
RE: "Plugin keeps its "ready to install"
Then it seems like it did not install properly.
Check \App_Data\plugins.json file. Is your plugin still in the "PluginNamesToInstall" section (near bottom of file)
Check your .csproj file. Be sure that output for build is under \Presentation\ . Example:
RE: "Localization does not function for the plugin views. "
The plugin he installation inserts localized string resources into DB table. If install is no completing, then that won't happen.
I run the app in VS.
The OutputPath is correct as you show.
And the plugin also appears in the plugins.json under "PluginNamesToInstall".
Check the System > Log for errors
After looking at the logs, it turns out it was a migration problem. After making the appropriate corrections to the database everything works as it should.
(Editor still complains for the _ViewImports though)
Thank you for your time and advice!