سؤال

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

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

(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!?

I had this error when copying a resource file from another project.

I solved this by deleting the global resource, adding a new resource and copying the data elements from the old to the new XML.

This results in the following settings for the resource:

  <ItemGroup>
    <Content Include="App_GlobalResources\Global.resx">
      <Generator>GlobalResourceProxyGenerator</Generator>
      <LastGenOutput>Global.Designer.cs</LastGenOutput>
    </Content>
  </ItemGroup>

I had the same issue. Whenever I published my app to the Small Business Server (SBS2008) it stuck on control name line but in fact on meta:resourcekey part of it. Non of the above mentioned solution helpd me.

I spent 6 hour figuring this out, finally I realised that this happend when I did some folder cleenup on the server. At the begning all my apps was located on E: in their folders but then I have created folders with names indicating to apps ApplicationPools and I move coresponding apps there.

I dont know how IIS7 on my SBS looking for resource files but definitely this was the issue. When I get back with my apps to E: again all started working like a charm.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top