Using Resource Files - not for localization


Bill Mell

I would like to use compiled resource files in my web application that are
not related to localization.
The idea is to have a dll with resources that can be accessed by the

I have no problem making the dll.
I am running into problems using it.

I am attempting to use the resource manager to get the values from the dll
and update the controls appropriately.

When I try to use it, I get a MissingManifestResourceException error saying
Could not find any resources appropriate for the specified culture (or the
neutral culture) on disk.

How can I avoid this?

Bill Mell





Not sure of your setup and why you get those errors.
I can tell you the way I use resources - see whether it works for you.
- In your dll set BuildAction for the files to "Embedded Resource"
- inside your dll define a function that would return the resource,
something similar to the following:
using System;
using System.IO;
using System.Reflection;
public class MyDllClass{
private static Assembly _asm = Assembly.GetExecutingAssembly();
private static Type _localType = typeof(MyDllClass);
public static Stream GetResource(string location, string name)
return _asm.GetManifestResourceStream(_localType, location + "." + name);

if your resource files are grouped in a folder - you would specify the
folder name in location parameter, otherwise pass empty string. Note that
resource name is case-sensitive.

If you program in VB, I believe that you do not specify the location - it
does not create a namespace for folders.

To get a string from your Stream, use
new StreamReader(stream).ReadToEnd();

Hope this helps

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question