Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
854 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...