Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
850 views
in Technique[技术] by (71.8m points)

visual studio 2010 - 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!!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...