3

I'm having some problems with globalization. I inherited a very old project in ASP.NET 2.0. It has several globalization files for multiple languages.

However, when I build the application for deployment, it runs fine in our test environment. But when we copy the application to the production environment, it errors out on a <%$ Resources: Global, MyStringHere %>.

Stating that the MyStringHere wasn't found in the resource file.

Why would this run fine in development and test environments, but not in production? The files are exactly the same from one environment to the next (although the inetpub files are located in different directories on each machine).

Anyone have any ideas?

EDIT:

Very strange. If I call the resource from code behind.

public string _MyStringName = Resources.Global.MyStringHere;

This works fine in all environments.

But, using the old:

<%$Resources: Global, MyStringHere %>

Is erroring out in production only.

Sean
  • 2,496
  • 7
  • 32
  • 60

2 Answers2

0

Just a shot in the dark here but do you have key that is configured based on environment or machine names ? We do this in many of our projects. Some of our projects will only run in certain environment for specific reason. Another guess is to check if you have #if(DEBUG) somewhere which may be skipping code.

Zeus
  • 3,091
  • 6
  • 47
  • 60
  • No #DEBUG. It's very strange why it's doing this. The resource files haven't been changed in years, and the only thing that is changing is the App_GlobalResources.compiled file. The hash/filehash/resHash files have changed. – Sean Mar 05 '12 at 23:37
  • what happens when you do solution wide search for "MyStringHere" ...do you see it defined in the resource file ? – Zeus Mar 06 '12 at 00:00
  • Yes. It is defined -- it runs perfectly fine when in development and even when in release mode on the development machine. – Sean Mar 06 '12 at 00:20
0

Are you certain your .resx files from App_GlobalResources are copied to the deployment site? App_GlobalResources files are normally supposed to be used with Build Action = Content, and not Build Action = Embedded Resources.

On your development machine a setting of Embedded Resources works, because the files are still physically located in App_GlobalResources, and embedded. The embedded resources are just ignored. This can give you the false impression that your build actions are configured properly.

Ruben
  • 15,217
  • 2
  • 35
  • 45
  • Yes the resource files are on the production machines. However, selecting a resource file doesn't give me the option of "Build Action" in the properties. – Sean Mar 06 '12 at 00:21