K
Ken Allen
OK, for a number of reasons I have needed to begin experimenting with
resources sooner than I had planned (I had avoided it for now).
Step 1: I built the 'reseditor' application that is in the SDK
sub-directory, as instructed by the MSDN.
Step 2: I used the 'reseditor' to create a file named
"MyResources.resources" that contains only some string resources.
Step 3: I added this resource file to my existing test assembly (does not do
anything other than test the use of the string resources to generate
altername 'names' for enumerated values).
Step 4: In the class definition (for my form since that is all there is in
this test code), I added "ResourceManager _Resources;".
Step 5: In the constructor for this form I added "_Resources = new
ResourceManager("MyResources", Assembly.GetExecutingAssembly());" (I
actually wrapped this in a try/catch block just in case, but the code does
not cause an exception).
Step 6: In my code I generate the name of the resource string I want and
attempt to retrieve it: "result.Append("[Retrieved] " +
_Resources.GetString(resourceName));" -- I have checked that the name I am
passing is the name of one of the strings in the resource file.
Step 7: I get a MissingManifestResourceException reporting that it "Could
not find any resources appropriate for the specified culture (or the neutral
culture) in the given assembly."
Step 8: This fails for any string I attempt to read.
Step 9: If I examine the binary of the resource file (which is in the
assembly), the contents indicate that it is for the neutral culture.
What am I doing wrong?
-Ken
resources sooner than I had planned (I had avoided it for now).
Step 1: I built the 'reseditor' application that is in the SDK
sub-directory, as instructed by the MSDN.
Step 2: I used the 'reseditor' to create a file named
"MyResources.resources" that contains only some string resources.
Step 3: I added this resource file to my existing test assembly (does not do
anything other than test the use of the string resources to generate
altername 'names' for enumerated values).
Step 4: In the class definition (for my form since that is all there is in
this test code), I added "ResourceManager _Resources;".
Step 5: In the constructor for this form I added "_Resources = new
ResourceManager("MyResources", Assembly.GetExecutingAssembly());" (I
actually wrapped this in a try/catch block just in case, but the code does
not cause an exception).
Step 6: In my code I generate the name of the resource string I want and
attempt to retrieve it: "result.Append("[Retrieved] " +
_Resources.GetString(resourceName));" -- I have checked that the name I am
passing is the name of one of the strings in the resource file.
Step 7: I get a MissingManifestResourceException reporting that it "Could
not find any resources appropriate for the specified culture (or the neutral
culture) in the given assembly."
Step 8: This fails for any string I attempt to read.
Step 9: If I examine the binary of the resource file (which is in the
assembly), the contents indicate that it is for the neutral culture.
What am I doing wrong?
-Ken