Search code examples
c#.netvisual-studio-2010

how to get string values stored in resource file(.resx)


I am facing a weird issue. I have a windows application running with few projects in VS2010 where resource file related in formations are in a separate project.I added one more winform project and tried to get a newly added value from resourcefile(.Resx) file project .But i am not getting that value. Again i added one more dummy winform project and tried to get the same newly added resource value, and surprisingly i am getting values. So i wonder what is going on in newly added project. Can any body suggest me what are the things i need to do??

I am accessing resource values in a newly added winform project like shown below.Here "Sample" is a class used in resource related sperate project called Test.Resources

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
    using Test.Resources;
    
       static class Program
        {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                MessageBox.Show(Sample.leaves.GetString("Admin.MinInvalid.Error"));
                Application.Run(new Form1());
    }

UPDATE

IS this issue related to signing problem. Because newly added WinForms project is signed with a key where as the dummy project is not


Solution

  • When i deleted project and added it again with release dll it works, thanks