Cannot see resource namespaces in an ASP.NET MVC application

Everything was fine, but suddenly the resources stopped working. I have an ASP.NET MVC5 application.

All I see is this message:

Mistake 3: The type or name of the namespace "User" does not exist in the namespace "MyProject.Resources" (do you miss the assembly reference?)

But this problem is only in .cs files ! The Views are OK! All I see, for example, in some kind of controller is Resources.App_LocalResources , but this is an empty namespace. In the .cshtml file I see all my resources! There seems to be some kind of problem with Visual Studio because it happened all of a sudden. Everything was fine before. Any ideas?

I have already restarted Visual Studio many times, I have another computer. But nothing has changed.

EDIT:

The problem is resolved. I replaced the .csproj project of my resource with an older version. I had to add a few more files, but now everything is in order. So this was a damaged project file.

+1
3

" ", Core/database. , "edit". csproj. ,

+2

! 10 !

9 - . 10- ! , !

?!

0

, :

  • Change Resource Propertie "Custom Tool" to "PublicResXFileCodeGenerator".
  • After changing this property, the resource class is automatically updated as follows: Class Updated .

After these steps, I was able to make the correct link to the resource file.

Hope this helps!

0
source

All Articles