Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit ASP.NET MVC 3 resx files in deployment server without recompiling

This is my first question here!

I have one ASP.NET MVC 3 Project with a Properties folder, containing some .resx files used to difference content in my views by language (en/es). I'm working in VS2010 with .Net 4.

When I deploy the application to server, I find that no resx files are published, and instead of it, I have some .dll files.

I have set the build action to Embedded resource , Do not copy to output directory and PublicResXFileCodeGenerator as Custom Tool in .resx files properties.

I want to have .resx files on the server and be able to edit them without recompile or redeploy. The views should use those changes.

How can I do that?

Thanks for your help!!

like image 591
Jawen Avatar asked Jul 18 '12 14:07

Jawen


Video Answer


1 Answers

Put the resx files in your App_GlobalResources and change the "Build Action" to Content and "Copy To Output Directory" to false. Make sure the "Custom Tool" is set to GlobalResourceProxyGenerator

That should make them changeable even at runtime.

You can simply use xpath to query over them, take the keys, values and comments and edit them as you wish using an XDocument.

You should also know that such a thing won't work with visual studio's publish because App_GlobalResources is not allowed with precompiled website.

like image 120
Adam Tal Avatar answered Nov 09 '22 01:11

Adam Tal