Can I edit the resource file at runtime

I have a WCF service, this is a response with JSON. I need to create a language file that I can edit on a production server. no problem if I need to restart the App pool.

I was about to use a resource file, but I was worried that it was not edited by the end user. I do not need to edit it pragmatically, the end user will edit it by opening the file in notepad without recompiling the application.

What are you offering?

thanks

+4
source share
4 answers

Yes, you can use the ResXResourceWriter class.

If you need to generate the Designer.cs file, and also see this question, Programmatically create Designer.cs for the resx file (ResXResourceWriter / ResXResourceReader)

If you need to modify existing resx files, check out this question Changing a .resx file in C #

+4
source

According to MSDN, you can add a new resource at runtime:

You can gradually add resources for new cultures after you deploy the application. Because subsequent development of culture-dependent resources can take a considerable amount of time, this allows you to first release the main application and deliver the cultural resources at a later date.

http://msdn.microsoft.com/en-us/library/sb6a8618%28v=vs.110%29.aspx

I think editing the current resource will also work.

+1
source

Your users should be able to edit files without problems, resource files are XML files that can be opened in notepad or in any text editor, they can even open it in Excel and get several columns that they can easily edit.

This will require re-processing your application pool, but you are open to it.

[edit] You do not need to recompile, as I mentioned earlier, if your resource files are marked as content, but your application pool will be recycled to receive changes.

0
source

I'm not sure, but it seems that the user cannot edit the resource file using notepad at runtime, and the application should be rebuilt when the changes take effect.

Customizing a file with a user area can do the job.

0
source

Source: https://habr.com/ru/post/1443942/


All Articles