Build Action 设置为 Embedded Resource
来源:互联网 发布:win7固态硬盘优化工具 编辑:程序博客网 时间:2024/06/06 18:35
Microsoft .NET 框架支持两种资源 — 无类型清单资源和有类型资源。通过将文件的 Build Action 设置为 Embedded Resource,可以让 Visual Studio .NET 支持无类型清单资源,并通过 .resx 文件(可以是自定义文件或作为组件资源的备份存储)支持有类型资源。清单资源的好处是,它们可在 IDE 中直接编辑,而有类型资源需要做特别的工作才能编辑,但可提供有类型访问。两种资源类型都有某些严格的命名要求,所以在编写方法调用来加载它们时要格外小心。
读取无类型清单资源
var ass = Assembly.GetExecutingAssembly();
//查询所有的Embedded Resource
foreach (var file in ass.GetManifestResourceNames())
Console.WriteLine(file);
//you can find resourceName above, always like this
//..
var stream = ass.GetManifestResourceStream(resourceName );
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
File.WriteAllBytes(fileName, buffer);
有类型资源指Resource.resx文件,请参考
http://blog.csdn.net/kevindr/article/details/46722437
- Build Action 设置为 Embedded Resource
- Resource and Embedded Resource
- WP7 working with Images: Content vs Resource build action
- jenkins为build设置description
- Build action
- 为SharePoint 2013 Online 设置 Resource Quota
- note : Release program embedded resource
- Visual Studio 中项目文件属性的Build action 设置
- 为jenkins的每个build设置description
- 为Snappy Ubuntu 产品build设置ssh
- 如何为Docker build设置http_proxy
- IAR Embedded Workbench >> Build Configuration
- 设置servlet或action为起始页
- 新浪旧事-设置action为welcomefile
- struts2为action设置静态参数
- 3.Struts设置ActionForm为session Action
- Daily build resource
- 为 Azure Resource Manager 中的虚拟机设置 WinRM 访问权限
- iOS积累 003:iOS中延时执行的几种方式的比较和汇总
- synergy使用
- 《Java并发编程实践》笔记7——非阻塞同步算法
- 在嵌入式设计中使用MicroBlaze(Vivado版本)
- 阅读zepto.js的core中的Core methods
- Build Action 设置为 Embedded Resource
- AfxMessageBox定时自动关闭
- warning: the ‘gets' function is dangerous and should not be used
- Android文件重命名File.renameTo()以及定义副本名方法(自定义规则)
- Java编程规范
- 46期学习心得连载4-牟文华
- 《Java并发编程实践》笔记7——非阻塞同步算法
- lldb调试IPHONE步骤
- Visual Studio 中项目文件属性的Build action 设置