Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Editing resource files without recompiling ASP.NET application

I'd like to enable the resource files to be editable after deployment. I read this post which suggests that this is possible, but I can't seem to figure out what settings I need to change to enable this.

I have added the App_GlobalResources folder to my ASP.NET 3.5 "Web Application" and added a resource file to this folder. I assume that the Build Action for this file needs to be changed, but no matter what I change the Build Action to, I cannot achieve the above stated functionality.

The App_GlobalResources folder and the resource file are copied into the bin directory. Once deployed, any edits to the .resx file are not being displayed.

Any ideas?

like image 546
deckerdev Avatar asked Apr 23 '09 18:04

deckerdev


People also ask

Do RESX files need to be deployed?

You do not need to deploy . resx file with your application.

What is RESX file in asp net?

You can use application resource files (. resx) to efficiently create a localizable Microsoft ASP.NET Web application. By using resource files, you can store localized values for controls. The localized values are based on a user's language and culture.

What is the use of RESX file in C#?

Resources in . resx files. Unlike text files, which can only store string resources, XML resource (. resx) files can store strings, binary data such as images, icons, and audio clips, and programmatic objects.


2 Answers

A Web Application project is different than a Web Site project. I doubt you can achieve what you want with a Web Application project. You might check out this post:

ASP.NET Web Site or ASP.NET Web Application?

Resources are generally meant to be static. They are items such as images, strings, and files that your program consumes and can rely on being present, (and therefore can be strongly typed in the case of strings/RESX files). The reason for using resources is simply to bundle them in with your DLL's so that distribution and referencing the resources becomes much easier.

Editable at runtime suggests you might want to use project or user Settings, or maybe a database? If you need to use RESX files you might need to write code to read/write them.

like image 44
womp Avatar answered Sep 23 '22 16:09

womp


You can achieve this, and I just did it.

Select the resource file in your project. Change the Build Action to content. Make sure that the Copy to Output Directory setting is turned OFF. When you deploy your project, the App_GlobalResources directory and your .resx file will get copied to the root of your web site. You can modify the .resx file and your live site will recognize the changes.

like image 86
Mike Cole Avatar answered Sep 24 '22 16:09

Mike Cole