如何将一个exe文件和两个dll文件集成到我的visual basic程序中



我正在用窗体编写一个visual basic GUI程序。现在我的程序使用了一个名为adb.exe的可执行文件(命令行程序)。这个文件依赖于2个dll文件。我想把这3个文件集成到我的程序中,这样我就可以执行adb.exe文件中的命令。我该怎么做?我只需要集成部分。我知道如何执行命令的部分。我试着把这3个文件放进我在visualstudio的项目中,但它不起作用。

将它们添加为资源,并将它们设置为嵌入式资源。当你需要它们时,你可以用类似的代码提取它们:

Dim Resourcename() As Byte = My.Resources.yourresourcename
Dim FileN As New System.IO.FileStream("path to the wished location and filename", System.IO.FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite)
Dim BW As New System.IO.BinaryWriter(FileN)
BW.write(Resourcename)
BW.Close()
FileN.Close()

将它们添加到应用程序的资源

在项目选项卡下,选择属性。从属性菜单中,选择引用选项卡,并将所有引用的"复制本地"设置为true。

现在"发布"程序,所有引用都将包含在生成中并正确引用。

最新更新