Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global resources can't be resolved after publishing Website in VS2008

I have a web-project running in VS 2008. We have some global resource files (*.resx) in the App_GlobalResources folder for internationalisation. All this works like a charm on my local IIS installation out of VS.

But when I publish my web-project to the local filesystem and/or another server, all the resources can no longer be found. So I guess the pre-compilation is somehow corrupting stuff. When I call the pre-compiled web, I get an error that the resource object with key xyz cannot be found, although it could be found before.

I checked with .NET reflector if the resource stuff made it into the *.dlls. All those identifiers are there (bin/Web.dll, bin/<culture>/Web.resources.dll). The identifiers are loaded like this:

<asp:MenuItem NavigateUrl="~/OrderNew.aspx" Text="<%$ Resources:MyProject, MenuNewOrder %>" Value="NewOrder">

The resource files are called MyProject.resx and MyProject.<culture>.resx where <culture> corresponds the the specific culture (i.e. MyProject.de-DE.resx).

Any ideas how to solve this?

I really appreciate any help.

Thanks

Edit:

If I copy the App_GlobalResources folder manually to the output, the resources may be loaded normally. So I really really wonder what this pre-compilation is all about.

I'm still interested in solving the issue "the right way".

like image 495
Scoregraphic Avatar asked May 12 '09 07:05

Scoregraphic


2 Answers

I had the same issue and had to make two changes to the resx file properties.

  1. Set the "Build Action" to Content
  2. Set the "Copy to Output Directory" to Copy always
like image 97
Shaun Bowe Avatar answered Sep 30 '22 00:09

Shaun Bowe


(I can't comment on the previous answer...no reputation yet...?)

This did not solve my problem, I'm afraid.

When trying the "Content/Copy Always" solution I get an exception saying that the linking at compile time did not work.

Why does asp.net need the resx file when the resources are compiled in!?

like image 33
JERKER Avatar answered Sep 30 '22 00:09

JERKER