Julie

Julie

  • NA
  • 22
  • 12.5k

Need help with Resource file usage

Jul 24 2008 4:06 PM

The lastest application that I am working on calls for custom Exception Handling.  Using the article "Custom Exception Handling in C# by Susan Abraham" (http://www.c-sharpcorner.com/UploadFile/susanabraham/CustomExceptionHandling06022005011154AM/CustomExceptionHandling.aspx) as a leaning basis, I keyed in the sample code.  My implementation of the sample code doesn't work.  I receive the following error:

"Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "Exceptions.resources" was correctly embedded or linked into assembly "CustomException" at compile time, or that all the satellite assemblies required are loadable and fully signed."

I have three files:

CustomException.cs which contains the class CustomException.  With a constructor creates the parts of the message.

CustomMessage.cs instanciates a Resource Manager and Culture objects:
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
ResourceManager rm = new ResourceManager("Exceptions", Assembly.GetExecutingAssembly());

The error occurs in the next line of code:
String str = rm.GetString(key, ci);

The final file is Exceptions.resx (and Exceptions.Designer.cs).  It contains the key/value pair "test"/"test exception".  All three files share the same NameSpace of  "CustomException".  I am writing this application using VS2008 for FW 2.0

What am I missing?


Answers (2)