Adding resources file in an assembly using visual studio 2010
I wanted to have culture specific resources in my application. What i did is i created a Resource.txt and compile this to Resource.resources using resgen.exe.
However, if i access my resource using:
System.Resources.ResourceManager rm = new System.Resources.ResourceManager("ResourceManager.Resources",
Assembly.GetExecutingAssembly());
and if i will call Console.WriteLine(rm.GetString("test"));
it will throw an error
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "ResourceManager.Resources.resources" was correctly embedded or linked into assembly "ResourceManager" at compile time, or that all the satellite assemblies required are loadable and fully signed.
My resource file is Resources.txt with text inside "test=testing" and will be compiled into Resources.resources.
Question:
How can i link the compiled resources to the assembly using the IDE(Visual Studio 2010)?, not using the csc, or AL on command line.
Is there any other recommended way how to accomplish this? I have added .resx files in visual st开发者_运维技巧udio and its working, however its not favorable for me, i favored the txt file with key=value type set up.
Try to use
System.Resources.ResourceManager rm = new System.Resources.ResourceManager("Resources",
Assembly.GetExecutingAssembly());
instead.
精彩评论