资源文件(.resx)不自动包含在项目中 [英] Resource File (.resx) not Automatically include in project

查看:57
本文介绍了资源文件(.resx)不自动包含在项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



i我试图动态添加资源文件并使用下面的代码它工作正常但是一旦它创建我必须手动添加使用



右键单击 - >包含在项目中你能告诉我如何动态实现这个东西(没有右击 - >包含在项目中)



Hello,

i am trying to add resource file dynamically and using bellow code it's working fine but once it's create i have to manually add that using

right-click->include in project can you please tell me how to achieve this thing dynamically (with out right-click->include in project)

using (ResXResourceWriter resx = new ResXResourceWriter(path))
{
resx.AddResource("valFirstname", "Prénom Must requis");
resx.AddResource("valLastname", "Nom Must requis");
resx.AddResource("valPassword", "Mot de passe doit requise");
resx.AddResource("valUsername", "Nom d'utilisateur Doit requis");
resx.Generate();
resx.Close();
}



请回答我,我被困在这个


Please answer me i am stuck in this

推荐答案

这应该有帮助:

http://msdn.microsoft.com/ en-us / library / gg418542(v = vs.110).aspx [ ^ ],

具体如下:

This should help:
http://msdn.microsoft.com/en-us/library/gg418542(v=vs.110).aspx[^],
specifically this:
MSDN:

您不能在运行时可执行文件中嵌入.resx文件或将其编译为附属程序集。您必须使用资源文件生成器(Resgen.exe)将.resx文件转换为二进制资源(.resources)文件。然后,生成的.resources文件可以嵌入应用程序集或附属程序集中。有关更多信息,请参阅为桌面应用程序创建资源文件。

You cannot embed a .resx file in a runtime executable or compile it into a satellite assembly. You must convert your .resx file into a binary resource (.resources) file by using the Resource File Generator (Resgen.exe). The resulting .resources file can then be embedded in an application assembly or a satellite assembly. For more information, see Creating Resource Files for Desktop Apps.



其他部分的链接在这里

http://msdn.microsoft.com/en-us/library/xbx3z216(v = vs.110)的.aspx [ ^ ]

它基本上说你需要运行resx thorugh resgen.exe,然后将生成的 .resource 文件编译到通过AI.exe汇编或链接它。我认为这两者都不比直接添加更好。



你可以做的一件事是创建一个特定的资源程序集,它被消费项目引用 - 如只要后者仍然不知道资源构建号,你就可以重新部署一个新版本的资源dll。



免责声明:我还没有做过很多这些东西在一段时间内 - 希望有人会提供一个更简单的解决方案。


The link for the other part is here
http://msdn.microsoft.com/en-us/library/xbx3z216(v=vs.110).aspx[^]
It basically state that you need to run the resx thorugh resgen.exe, then either compile the resulting .resource file into the assembly or link it via AI.exe. Neither of which are much better than option of adding directly I suppose.

One thing you can do is create a specific resources assembly that gets referenced by the consuming project - as long as the latter remains agnostic of the resources build number, you can just re-deploy a new version of the resources dll.

Disclaimer: I haven't done a lot of this stuff in a while - hopefully someone will provide a simpler solution.


这篇关于资源文件(.resx)不自动包含在项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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