0
votes

I have added a resource file in App_GlobalResources called FileList.resx.

Now I access the contents within the code by using

My.Resources.FileList.astro1 etc.

It works fine if I set the Build Action of resource file to Embedded. However in this case the resource file is not available after compile and I can't change it later.

If I set the Build Action to Content I get an error : Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "WAP.FileList.resources" was correctly embedded or linked into assembly "WAP" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Please advice me.

2

2 Answers

0
votes

Are you using a Visual Studio Web Application? Or a Web Site?

In the latter case, you should be able to change the Resource file after deploying the site, and it should get automatically recompiled on the server. In the former case, it's a built-in that can't be changed after the site is compiled before deployment.

If that's a problem for you, there are of course alternatives to Resource files....

0
votes

In any way of compiling and deploying your application all resource files will compiled in related to each resource file assemblies. In all cases, resource assemblies are ultimately created for each directory in the site, and satellite assemblies are generated beneath their respective culture-specific directories. Even when the site is JIT-compiled, the outcome is equivalent.

So, you must use Build Action of resource file to Embedded, but as possible solution for dynamic resource definition you can place you resources in a database. And even provide a Resource provider. In that case your database solution would have all the benefits that suggested by resource management aka dynamic culture definition, using resource binding to control, etc.

Here you can find some tutorials how to implement Resource-Provider Model in your application:

  1. Extending the ASP.NET 2.0 Resource-Provider Model
  2. Creating a Data Driven ASP.NET Localization Resource Provider and Editor