We help IT Professionals succeed at work.

Resx file in another assembly

praveenuni
praveenuni asked
on
Medium Priority
511 Views
Last Modified: 2012-05-06
I have a resx file (main.resx) in a project called projectA. I have a windows application projectB which has a reference to projectA. I'm using the resx file to store the strings (e.g. button name). How can I read the button name description in the resx file from projectB.

Thanks
Comment
Watch Question

Test Developer/Validator
Commented:
If your button name description is PUBLIC, and the resx file is embedded (uses PublicResXFileCodeGenerator as its "Custom Tool", and has an associated Resources.Designer.cs file, it is easy to see name space definition  and variable name opening the Resources.Designer.cs file.

For example, in our Properties\Resources.Designer.cs you will find

        /// <summary>
        ///   Looks up a localized string similar to Assembly.
        /// </summary>
        public static string AssemblyLabel {
            get {
                return ResourceManager.GetString("AssemblyLabel", resourceCulture);
            }
        }
       
in a namespace of ProjectNamespace.Properties.


In another assembly, you would reference this as

ProjectNamespace.Properties.AssemblyLabel


If you do NOT use embeddded resources, you will have to use the ResourceManager to load the Resx file directly.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.