Demchenko Anton
Demchenko Anton

Reputation: 385

Resource namespace not exist if resource file named using culture prefix

I have a resource file named Res.en.resx in my Asp.Net Mvc 4 project.

In a view I'm trying to access its properties like this: @MvcApp.Resources.Res.Title but I'm getting the following error:

The type or namespace name 'Resources' does not exist in the namespace 'MvcApp' (are you missing an assembly reference?)

If I change resource name to Res.resx everything works fine.

Why is this happening?

Upvotes: 0

Views: 1190

Answers (1)

Panda_Of_Apocalypse
Panda_Of_Apocalypse

Reputation: 100

I believe you need to have at least a file named xxx.resx which contain the translation for the default language of your application.

So if your main language is french and you would like to have an english version, you need:

  • xxx.resx file which contain the default language of your app.
  • xxx.en.resx file which contain the english version of your file.

Hope this help!

Upvotes: 6

Related Questions