Search code examples
asp.netvisual-studio-2008resourcespublishingpre-compilation

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".


Solution

  • 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