2

My UI code used to be in only one project, so my localization files (*.resx) are in a single project.

Now I would like to use these strings (Properties_Resources.ResourceManager.GetString) in another project of the same C# solution.

I tried this answer but I get The name 'Properties_Resources' does not exist in the current context. (I guess that question is only for binary resources like images, not localization)

I tried to put my resources into a separate empty project with Class output, and added a reference to it from all other projects, but same error.

In an old forum discussion someone dumped links to Creating Resource Assemblies and Retrieving Resources with the ResourceManager Class but it is very low on explanations, and I find it hard to believe that reflection is the recommended way to go.

Community
  • 1
  • 1
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
  • Have you added the reference to the resource project? – Hamlet Hakobyan Jan 28 '14 at 10:35
  • Answers with a lot of screenshots always get upvoted on SO, they look good. But no, it doesn't actually work that good. The source control nightmare he recommends is quite notable. But your iceberg is the auto-generated Properties class, it has *internal* accessibility. Which means that you can't get to it from another assembly. You will have to wrangle ResourceManager yourself. It is *.resx btw :) – Hans Passant Jan 28 '14 at 11:32
  • @HamletHakobyan: Yes, the Resources project is added as reference in all other projects. – Nicolas Raoul Jan 29 '14 at 06:39

0 Answers0