将.exe文件集成到Visual Studio项目中 [英] Integrating a .exe file into a visual studio project

查看:260
本文介绍了将.exe文件集成到Visual Studio项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

断断续续的场景: 我在C#中有一个程序,该程序在cmd内调用一个.exe(使用process.start),并传递一些必需的参数.

broken to bare-bones scene: I have a program in c# that calls a .exe inside cmd(using process.start), passing some required arguments.

我要做什么:将exe包含到项目中,这样我就不必调用cmd.

What i'm trying to do: Include the exe into the project so that i don't have to call cmd.

有什么主意吗?

推荐答案

如果您只想包含它,则不必运送两个文件,则只需将其作为嵌入式资源"包含在项目中即可(请参阅项目项选项) ),然后可以调用ResourceManager.GetStream并将其写入文件并调用Process.Start.

If you just want to include so you don't have to ship two files then just include it into the project as "embedded resource" (see project item options) and then you can call ResourceManager.GetStream and write it to file and call Process.Start.

如果要集成该exe的功能,以便不再需要该exe(无需Process.Start),则需要源代码...

If you want integrate the functions of that exe so that the exe is not needed anymore (no Process.Start) then you need the source code...

如果exe是.NET,则不需要写入文件",那么您可以直接从资源流中将其作为Assembly/AppDomin加载并执行.

the "write to file" is not necessary if the exe is .NET - then you can directly load it from the resource stream as Assembly/AppDomin and execute it.

这篇关于将.exe文件集成到Visual Studio项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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