473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

ResourceManager Question

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


Nov 15 '05 #1
3 15993
Go to the file in the solution manager, right click it and select
properties. Make sure "Build Action" is set to "Embedded Resource".

Pete

--

http://www.petedavis.net
"Craig" <pe******@un.org> wrote in message
news:ux**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #2
Pete

I have already done that...

Craig

"Pete Davis" <pd******@hotmail.com> wrote in message
news:cf******************************@news.meganet news.com...
Go to the file in the solution manager, right click it and select
properties. Make sure "Build Action" is set to "Embedded Resource".

Pete

--

http://www.petedavis.net
"Craig" <pe******@un.org> wrote in message
news:ux**************@TK2MSFTNGP11.phx.gbl...
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


Nov 15 '05 #3
It turns out that you need to qualify what ResourceManager is to look for.
To determine what string you actually need to use, I recommend running the .NET SDK command ildasm on the .dll or .exe containing the embedded resource. This should bring up a window that shows "MANIFEST". Clicking on that shows another window, look for .mresource public.

My resource file is LogMerger.resx.

In my case, it said "Dime.LogMerger.resources" where Dime is the namespace and LogMerger is the component.

I also did this on a sample application "LocDiff" with resource file LocDiff.resx whose namespace was "philips" but the entry was listed as "LocDiff.LocDiff", which I would not have guessed. So, you need to use ildasm.

I accessed the resources by:

ResourceManager resMgr = new ResourceManager("Dime.LogMerger", Assembly.GetExecutingAssembly());

String str = resMgr.GetString("ExtractLogsCabPathNull");

which looks for resources for the current culture ("en_US") and then looks for neutral culture, which is where I guess my embedded entries are.

By the way, to add the strings in VS .NET 2003, all I did was add a resource file (.resx) and then add the name value pairs, and ensured that the .resx file has the embedded property set. I didn't run any commands (no resgen).
Mar 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Techfan | last post by:
Is there a way to determine which resource file the resourcemanager GetString method utilizes in a fallback situation?
3
by: Nils Erik Asmundvaag | last post by:
Hello I hope someone is able to help me with this frustrating problem. I have a C# web project in Visual Studio .NET 2003. I want to support Swedish and Norwegian texts and have put the texts...
0
by: the_medeiros | last post by:
How i can use resources files to show display messages ??? I try use: private static ResourceManager resourceManager = new ResourceManager(typeof(ExceptionManager).Namespace +...
0
by: Weenie the Pooh | last post by:
We are writing an ASP.Net C# application (VS 2003) and plan to use embedded resources files for french, german and english UI. I created resx files named _todo.resx and _todo.fr-CH.resx Here...
0
by: Ramon Rocha | last post by:
Dear friends, How do I do to create a ResourceManager in global.asax? I was tried: Application("RM") = New ResourceManager("strings", Server.MapPath("resources"), Nothing) But return, on...
7
by: Dennis | last post by:
I have a .resx (xml) file that contains resources. I am trying to follow the example in MSDN for creating the resource Manager as follows: Dim myAssembly As System.Reflection.Assembly...
1
by: Franz | last post by:
I know how to use ResourceManager, but I think I don't use it wisely. I have a web user control. Inside the control, I need to call ResourceManager.GetString. However, I also need to call...
0
by: ad | last post by:
We can get the string in Resource with ResourceManager like: ResourceManager rm = new ResourceManager(this.GetType().NameSpace+".Properties.Resources", this.GetType().Assembly); string...
2
by: ngrover | last post by:
When accessing strings from a french language utf-8 .txt file (that has been resgen'ed into a .resources file) via ResourceManager.GetString() method, I am encountering a problem. All the special...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.