@T doesn't exist in current context

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi everybody
I'm trying to develop a plugin for nopcommerce 4. I started development by copy and paste existing module and renaming class and folders. But now i have a strungly problem. Inside view i receive for @T("<someresource>") the error

"@T doesn't exist in current context"

inside other modules this error doesn't occur and i can see derived class

public abstract class NopRazorPage<TModel> : Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>

properly. What is wrong in my scenario ? Another problem is also that debug are not working and break point are unreachable.

Thanks in advance
6 years ago
Hi Ceaser,

Makes sure you have view file "_ViewImports.cshtml" under views folder.

If it not exist than copy from "Presentation > Nop.Web > Views" and paste it.

It'll work.
6 years ago
Problem solved doing as you said.

Thanks very much !
5 years ago
can somebody tell that, what exactly is @T()
what it does
5 years ago
abdul_clanstech wrote:
can somebody tell that, what exactly is @T()
what it does


Read existing post.

Hope You will understand what it is.

Thanks,
Jatin
3 years ago
Hi ,  

i have the same problem as cesare.marasco in nopcommerce 4.4 in  a plugin in Configure.cshtml

"@T doesn't exist in current context"

the   _ViewImports.cshtm is here :
@inherits Nop.Web.Framework.Mvc.Razor.NopRazorPage<TModel>
@inject Nop.Services.Common.IGenericAttributeService genericAttributeService
@inject IWorkContext workContext
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Nop.Web.Framework

@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@using Microsoft.AspNetCore.Routing
@using Microsoft.Extensions.Primitives
@using Nop.Core
@using Nop.Core.Domain.Common
@using Nop.Core.Infrastructure
@using Nop.Services.Events
@using Nop.Web.Framework
@using Nop.Web.Framework.Models
@using Nop.Web.Framework.Events
@using Nop.Web.Framework.Extensions
@using Nop.Web.Framework.Infrastructure
@using Nop.Web.Framework.Models.DataTables
@using Nop.Web.Framework.Security.Captcha
@using Nop.Web.Framework.Security.Honeypot
@using Nop.Web.Framework.Themes
@using Nop.Web.Framework.UI

any ideas?
3 years ago
benelli wrote:
Hi ,  

i have the same problem as cesare.marasco in nopcommerce 4.4 in  a plugin in Configure.cshtml

"@T doesn't exist in current context"

the   _ViewImports.cshtm is here :
@inherits Nop.Web.Framework.Mvc.Razor.NopRazorPage<TModel>
@inject Nop.Services.Common.IGenericAttributeService genericAttributeService
@inject IWorkContext workContext
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Nop.Web.Framework

@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Mvc.ViewFeatures
@using Microsoft.AspNetCore.Routing
@using Microsoft.Extensions.Primitives
@using Nop.Core
@using Nop.Core.Domain.Common
@using Nop.Core.Infrastructure
@using Nop.Services.Events
@using Nop.Web.Framework
@using Nop.Web.Framework.Models
@using Nop.Web.Framework.Events
@using Nop.Web.Framework.Extensions
@using Nop.Web.Framework.Infrastructure
@using Nop.Web.Framework.Models.DataTables
@using Nop.Web.Framework.Security.Captcha
@using Nop.Web.Framework.Security.Honeypot
@using Nop.Web.Framework.Themes
@using Nop.Web.Framework.UI

any ideas?

Please also check if you do this as well. Copy to Output Directory -> Copy if newer

If you set this already then check plugin output directory whether your _ViewImports.cshtml exist there or not.

Note: Right now nopCommerce latest release version is 4.30
https://github.com/nopSolutions/nopCommerce/releases/
3 years ago
_ViewImports.cshtml  was missing in outputdirectory.  Now it works.

Thanks very much !
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.