New Theme Error. (The name 'PublicWidgetZones' does not exist in the current context)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi,
I would like to create a new template based on the default template.
However, after copying, for example, the _Header.cshtml file from \ NOP41_demo \ Views \ Shared to NOP41_demo \ Themes \ NewTheme \ Views, the following error appears:

One or more compilation failures occurred:
D: \ WEBSERVER \ NOP \ NOP41_demo \ Themes \ Toys \ Views \ Shared \ _Header.cshtml (2.64): error CS0103: The name 'PublicWidgetZones' does not exist in the current context
D: \ WEBSERVER \ NOP \ NOP41_demo \ Themes \ Toys \ Views \ Shared \ _Header.cshtml (8.71): error CS0103: The name 'PublicWidgetZones' does not exist in the current context
D: \ WEBSERVER \ NOP \ NOP41_demo \ Themes \ Toys \ Views \ Shared \ _Header.cshtml (15,64): error CS0103: The name 'PublicWidgetZones' does not exist in the current context
D: \ WEBSERVER \ NOP \ NOP41_demo \ Themes \ Toys \ Views \ Shared \ _Header.cshtml (27.64): error CS0103: The name 'PublicWidgetZones' does not exist in the current context

Can you ask for help? I'm a beginner, I'm sorry if that's a stupid question ...
5 years ago
Have you first copy _ViewImports.cshtml ?
https://github.com/nopSolutions/nopCommerce/blob/develop/src/Presentation/Nop.Web/Views/_ViewImports.cshtml

Regards,
Tom
5 years ago
Thank you for the quick reply.
This file was already in the directory. (D:\WEBSERVER\NOP\NOP41_demo\Themes\NewTheme\Views)
I did not copy it again.
5 years ago
I will also say, that files from the "components" directory after copying and renaming the file from default.cshtml to the name of the new template (newTheme.cshtm) do not cause this error. (Without changing the name they cause).

Do you have any idea?
5 years ago
thepeche wrote:
Do you have any idea?

Yes, open _ViewImports.cshtml file, and add @using Nop.Web.Framework.Infrastructure
That will fix issue.

Regards,
Tom
5 years ago
It's work! Than You very much!
4 years ago
I don't understand. I need to be detail interpreted.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.