.NET: embed an EXE file into my project

embed, exe, vb.net

Solution

I'm thinking create a RAM disk, write your exe file/s to it from your .NET resource file, and execute the file there. Nothing touches physical disk.

I don't have a link for a programmable RAM disk API but you can likely find something to manipulate from your program. The other benefit is virus scanners can still acknowledge it for security.

Also I'm thinking if your app is running on disk then there's no good reason why the executable in question can't be on disk too. If you're piping it in over the network (downloading) it or something, then save to disk first and erase it when done execution.

Problem

I know that is strange situation, but I need to embed an EXE file (or the assembly code) into my project, so it can be started only by the application (it can't create the EXE in the filesystem and start it)... Is it possible? Edit: It's not a .NET EXE. Anyway I added the Test.exe file as a resource to my project and I did this ``` Dim exestr As Stream = Nothing Dim a As Assembly = Assembly.GetExecutingAssembly exestr = a.GetManifestResourceStream("Test.exe") ```

Original source