0

STEP 1: OK,I know I have read every page on the net about this so I finally broke down and ended up here at SOF.

Here is my resource file code:

using (ResourceWriter rw = new ResourceWriter(@"C:\pathto\errors.resources"))
{
  rw.AddResource("String1", "en-US");
}

So obviously, now i have my errors.resources file created w/the string resource named String1, w/the value of "en-US" in it.

STEP 2: So then after that I simply create my satellite assembly with:

c:\>al /t:lib /culture:en-US /embed:C:\pathto\errors.resources /out:C:\pathto\bin\en-US\MyWeb.Ext.errors.resources.dll

Ok...so cool.

STEP 3: So now in my project:

Thread.CurrentThread.CurrentCulture = newCulture;
Thread.CurrentThread.CurrentUICulture = newCulture;
ResourceManager rm = new ResourceManager("MyWeb.Ext.errors", this.GetType().Assembly);
ViewData["String1"] = rm.GetString("String1");

But no matter what I do...I can not access that string resource in the assembly. I can include my errors.resources file in the project and get it that way, but I need it to be in this assembly so I can use this assembly for another project too!

Can someone tell me what I might be doing wrong on step 3?? Or maybe I did something wrong in a prior step??

Jester
  • 56,577
  • 4
  • 81
  • 125

1 Answers1

0

Where is your resource file located relative to your assembly? You should create a directory containing the name of the locale the resource file is for (en-US in your case), and then place the satellite assembly in there. This directory should be in the same directory as the original assembly.

Andy
  • 30,088
  • 6
  • 78
  • 89
  • Ive put it at appdir/en-US, ive put it in appdir/bin/en-US, ive put it in appdir/bin/bin/en-US all at the same time. by same directory, do you mean in the bin folder? currently its in bin/en-US/MyWeb.Ext.errors.resources.dll. my errors.resource file isnt anywhere relative to the Satellite assembly, but prior, i have had them all in the same bin/en-US directory. – user3123818 May 23 '14 at 20:03
  • The resource DLL should be in a folder called en-US. The en-US folder should be in the same folder as your assembly. Another thought - have you confirmed that `newCulture` is en-US? – Andy May 23 '14 at 21:31