Re: Message Resource DLL C# integration
- From: Jeroen Mostert <jmostert@xxxxxxxxx>
- Date: Wed, 06 Feb 2008 00:47:08 +0100
Hamish wrote:
I'm looking to set up a .NET service (written in C#) that will write events to the event log and use a message resource dll to provide localized message text for the events.
The framework uses a clever hack to get event log messaging to work without the need for hardcoding strings in some DLL: all .NET event sources use mscoree.dll as the event message file, and this has a resource block with all possible message strings set to "%1" (i.e., just the first argument of a formattable string) so it can pass anything it likes directly to the API.
The thing that surprises me is that I still seem to need to use mc.exe and rc.exe to generate the resource only DLL and then I don't see a straightforward way to integrate the generated header file (with the category and message symbolic names) into the C# code for the service.
No, don't bother with all that nonsense, it's completely superfluous for ..NET applications.
For localization, .NET uses satellite assemblies and the ResourceManager class. Look it up in the docs, it's pretty straightforward. When you want to write to the event log, you can just write whatever string you want, including localized strings you looked up.
--
J.
.
- Prev by Date: Re: regular expression help
- Next by Date: Re: Forms Authentication problem with WebRequest
- Previous by thread: I'm calling Marshal.ReleaseComObject but com objects are still leaking. How to properly release MODI.Document??
- Next by thread: Re: Forms Authentication problem with WebRequest
- Index(es):
Relevant Pages
|