Labels

Thursday, March 29, 2007

ResourceManager vs GetLocalResourceObject

Posted by me on ASP.Net Forums

-----------------------------------

Major difference lies in the kind of project you are in.

If you are in a Class Library project, where the resource files are stored as Binary files rather than XML file, you can only use ResourceManager and not the GetLocalResourceOject to extract the value from the Resource bundle.

Else, If you are into some Web Solution, where the resource files are stored as XML files rather than Binary file, you have to use GetLocalResourceOject .

Summary is :

  • ResourceManager can only extract resources from the Binary files [.resources] and not from XML files [.resx]. See below Note....
  • GetLocalResourceOject, opposite of above.

Note : if you try to extract resources from .resx file using ResourceManager, you will face below error.

"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "CountryNames.resources" was correctly embedded or linked into assembly "App_Web_translation.aspx.cdcab7d2.pj5mpytf" at compile time, or that all the satellite assemblies required are loadable and fully signed."

Hope it might help you to know the difference.



No comments:

Post a Comment