I'm writing a program that I want to attach another program (.exe) to. I tried adding it as a resource, but I can't seem to get the resource to export out to wherever the program is running.
Printable View
I'm writing a program that I want to attach another program (.exe) to. I tried adding it as a resource, but I can't seem to get the resource to export out to wherever the program is running.
Why would you want to include an exe in your application like that? I'm not 100% on this but if your application extracts an .exe file "on the fly" like that, certain Antivirus software might flag it as a possible malicious action.
I hadn't thought of that.
Basically, I'm trying to deploy my application with another application I've previously written.
Hi there
The code example below shows how I did what you're asking.
For this to work you need to add the following at the very top of your forms code, before the Public Class Form statement.
First, I check to see if the directory containing the exe exists. If not I create it.Code:Imports System.IO
Next, I copy the exe from my.resources to the created directory.Code:If Not Directory.Exists(full folder path here) Then
Directory.CreateDirectory(full folder path here)
End If
Hope this helps.Code:If Not File.Exists(full path to file including filename and extension) Then
File.WriteAllBytes(full path to file including filename and extension, My.Resources.yourprogram)
End If