ResourceManager Question

  • Thread starter Thread starter Pete Davis
  • Start date Start date
P

Pete Davis

Go to the file in the solution manager, right click it and select
properties. Make sure "Build Action" is set to "Embedded Resource".

Pete
 
Hi

I'm creating a web control whereby I use a resource file to store strings
for property descriptions and so forth.

The namespace for the control is: Unsd.Web.WebControls all classes in the
control use this namespace. The assembly file name is
Unsd.Web.WebControls.Banner.dll and the resource file name which resides
in the same directory as the class files is Unsd.Web.WebControls.resources
(Build Action=Embedded Resource) The Culture is nautral. The resourse file
was generated from the .resx file using the resgen tool.

I create a ResourceManager object by passing into the constructor the
namespace and the assembly reference i.e.

Type myType = typeof(Banner);
ResourceManager rm = new ResourceManager(myType.Namespace,
myType.Module.Assembly);

The resource manager object creates ok, but trying to read the resource
information, i.e the strings has got me stumped. I'm calling
(string)rm.GetObject("myKeyName")'

I end up with an error as follows:

Could not find any resources appropriate for the specified culture (or the
neutral culture) in the given assembly. Make sure that
"Unsd.Web.UI.WebControls.resources" was correctly embedded or linked into
assembly "Unsd.Web.UI.WebControls.Banner". baseName:
Unsd.Web.UI.WebControls locationInfo: resource file name:
Unsd.Web.UI.WebControls.resources assembly: Unsd.Web.UI.WebControls.Banner

Any ideas?

Craig
 
Pete

I have already done that...

Craig

Pete Davis said:
Go to the file in the solution manager, right click it and select
properties. Make sure "Build Action" is set to "Embedded Resource".

Pete
 
Back
Top