无需重新编译在部署服务器编辑ASP.NET MVC 3 RESX文件 [英] Edit ASP.NET MVC 3 resx files in deployment server without recompiling

查看:618
本文介绍了无需重新编译在部署服务器编辑ASP.NET MVC 3 RESX文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个问题在这里!

This is my first question here!

我有一个ASP.NET MVC 3项目有属性的文件夹,包含由语言习惯的差异内容在我的一些看法.resx文件(EN / ES)。 我在VS2010工作在.NET 4中。

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.

当我将应用程序部署到服务器时,我发现没有RESX文件发布,并代替它,我有一些.dll文件。

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

我已经设置生成操作到嵌入式资源不要复制来输出目录和 PublicResXFile codeGenerator 在.resx文件属性自定义工具。

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

我想在服务器上.resx文件,并可以对其进行编辑,而不重新编译或重新部署。该意见应使用这些更改。

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.

我怎么能这样做?

感谢您的帮助!

推荐答案

把RESX文件,在 App_GlobalResources文件并改变建设行动为内容和复制到输出目录为假。 确保自定义工具设置为 GlobalResourceProxyGenerator

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.

您可以简单地使用XPath查询过他们,拿钥匙,价值观和意见,并对其进行编辑,你想使用一个XDocument。

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

您应该也知道,这样的事情不会与工作Visual Studio的发布,因为App_GlobalResources文件未与precompiled网站不允许的。

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.

这篇关于无需重新编译在部署服务器编辑ASP.NET MVC 3 RESX文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆