如何将资源注入已构建的可执行文件中 [英] How does one inject resources into an already built executable

查看:18
本文介绍了如何将资源注入已构建的可执行文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要品牌化的 Windows 应用程序.客户会将其出售给其他企业,并且每次销售都需要一个定制的徽标和名称.

I am working on a windows application that will need to be branded. The client will be selling this to other businesses, and needs a customized logo and name for each sale.

客户不知道如何使用visual studio!

The client does not know how to use visual studio!

我想我需要编写一个打包应用程序来将自定义徽标和字符串资源注入到可执行文件中.我打算使用 WPF.但由于这是一个关键要求,如果这更容易,我愿意在 winforms 中完成.

I think I need to write a packager app to inject custom logo and string resources into the executable. I am planning on using WPF. But since this is a critical requirement, I'd be willing to do it in winforms if that is easier.

这样做的最佳方法是什么?欢迎任何和所有建议.

What is the best way to do this? Any and all suggestions welcome.

推荐答案

听起来您想要的是应用程序换肤.这并不意味着您必须解压 exe 并注入资源.您只需要从项目一开始就考虑换肤并构建应用程序来支持您的换肤需求.

It sounds like what you are after is application skinning. This doesn't mean you have to unpack the exe and inject resources. You just need to consider skinning from the start of the project and build the application to support your skinning requirements.

WPF 将使您的应用程序皮肤变得更加容易.有几种不同的方法可以实现您的愿望.

WPF will make skinning your app much easier. There will be several different ways to accomplish what you want.

最简单的方法是保留徽标图像松散并使用来自需要显示此图像的 XAML 文件的相对路径引用它.

Simplest is to leave the logo image loose and reference it with a relative path from the XAML file(s) that need to show this image.

您应该查看 WPF 中的资源词典,以及它们如何帮助您对资源进行分组和支持换肤.http://msdn.microsoft.com/en-us/library/ms750613.aspx

You should look into Resource Dictionaries in WPF and how they help you group resources and support skinning. http://msdn.microsoft.com/en-us/library/ms750613.aspx

文字会有所不同,但我不确定就文字而言您需要什么.您的意思是您需要本地化字符串还是只需要为不同的客户显示不同的文本(所有相同的语言环境)?

The text will be a little different but I am not sure what you need as far as a text goes. Do you mean you need to localize the strings or do you simply need different text (all the same locale) to show for different clients?

这篇关于如何将资源注入已构建的可执行文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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