By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,990 Members | 1,406 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,990 IT Pros & Developers. It's quick & easy.

Can't get hold of resources in .resx files

P: n/a
I just started trying localization for my web application.
I have class library as part of solution so I need to globalize / localize
this component too.

I created resource file in the assembly itself - Account.resx - the one that
VS offers.
And wrote code like this.

static ResourceManager stringManager=

new ResourceManager("AccountResources", Assembly.GetExecutingAssembly());

and in method

if (ex.Message.IndexOf("unq_a_AccountName") > 0)

throw new
AccountInformationException(stringManager.GetStrin g("accountWithNameExistsMessage"),
ex);

I get an error that Account.resource is not part of assembly.

Well I have Account.resx and VS2005 doesn't offer .resource.

So what should I do?

Thank you,

Shimon.
May 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Shimon

Whenever I come across resource issues, the majority of the problems
are to do with how you have named the resource file inside your
assembly.

Use the Reflector http://www.aisto.com/roeder/dotnet/ to open your
assembly up and see how the resource file has been named. Odds on it is
your naming that is the problem.

Cheers

Tim

May 15 '06 #2

P: n/a
Thank you.
You are correct.
Thank you for tool.
Shimon.
"Tim Ferris" <ti********@gmail.com> wrote in message
news:11**********************@j73g2000cwa.googlegr oups.com...
Hi Shimon

Whenever I come across resource issues, the majority of the problems
are to do with how you have named the resource file inside your
assembly.

Use the Reflector http://www.aisto.com/roeder/dotnet/ to open your
assembly up and see how the resource file has been named. Odds on it is
your naming that is the problem.

Cheers

Tim

May 15 '06 #3

P: n/a
Hi Shimon,

As for accessing resource items in localized resource file(resx ) compiled
in VS 2005 projects, the VS 2005 ide will help automatically generate
resource accessor class to access the resource items. We can call them to
retrieve resource items, e.g:

suppose I have a class library project (named SBI) in vs 2005, and add a
Resouce1.resx file(contains some string items like String1, String2....),
the IDE will help automatically generate the helper class so that we can
access the resource in the Resource1.resx file like below:

string str1 = SBI.Resource1.String1;

Also, we can use the resgen.exe tool to manually create such resource
accessor helper class:

#Resource File Generator (Resgen.exe)
http://msdn2.microsoft.com/en-us/library/ccec7sz1.aspx

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



May 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.