将 *.exe 嵌入到 dll 中 [英] Embedded a *.exe into a dll
问题描述
有人知道如何将 exe 文件嵌入到 dll 中吗?
does somebody know how can I embedd an exe file into a dll ?
我有一个工具,它是我从 c# 代码调用的 exe 文件.
I have a tool which is an exe file that I call from c# code.
问题是我想要 1 个包含此工具(exe 文件)的 dll 和包含我的 c# 代码的 dll.
The thing is that I want to have 1 dll containing this tool (exe file) and the dll containg my c# code.
是否可以在资源中嵌入这个 exe 文件?
Is it possible to embedd this exe file within the resources?
提前谢谢
推荐答案
当然可以.您可以在应用程序中将任何文件作为 RC_DATA 添加为资源.但是我相信你需要先将它解压到磁盘才能调用它!
Sure it is. You can add any file as RC_DATA in application as resource. But I believe you will need to extract it to disk first before calling it!
您使用的是哪种 IDE/语言?
Which IDE/Language you are using?
对不起!您确实提到您使用的是 C#.
Sorry! you did mention that you are using C#.
- 向您的应用程序添加资源文件(在 IDE 中右键单击应用程序并选择添加新项目".
- 使用资源编辑器中的工具栏添加现有文件.
- 然后在需要时通过调用如下代码提取 exe:System.IO.File.WriteAllBytes (@"C:MyEXE", Resource1.MyEXE);
这篇关于将 *.exe 嵌入到 dll 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!