Embedded Resource

B

brian

I previously posted a question about embedding and EXE
into a VB.NET EXE and being able to shell to the embedded
EXE.

A gentleman responded saying to embed the EXE in my
program as a resource. I could then access it as a
stream, write that stream out to a file and then shell
out to that file when needed.

I can access the embedded file by using
Reflection.Assembly.GetExecutingAssembly
().GetManifestREsourceStream("MyApp/RSYNC.exe")

But How do I write the stream to another file and shell
to it? Since it is an EXE I want to use streaming it to
a file work?

Any suggestions?

Thanks
 
A

Armin Zingler

brian said:
I can access the embedded file by using
Reflection.Assembly.GetExecutingAssembly
().GetManifestREsourceStream("MyApp/RSYNC.exe")

But How do I write the stream to another file and shell
to it? Since it is an EXE I want to use streaming it to
a file work?

Any suggestions?


http://msdn.microsoft.com/library/en-us/cpguide/html/cpconworkingwithio.asp

http://msdn.microsoft.com/library/en-us/vbcn7/html/vaoriReadingWritingToRegistry.asp

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
P

Patrick Steele [MVP]

But How do I write the stream to another file and shell
to it? Since it is an EXE I want to use streaming it to
a file work?

See the FileStream class (Write method) for creating the file and then
System.Diagnostics.Process class for executing the program.
 
H

Herfried K. Wagner [MVP]

* "brian said:
I previously posted a question about embedding and EXE
into a VB.NET EXE and being able to shell to the embedded
EXE.

A gentleman responded saying to embed the EXE in my
program as a resource. I could then access it as a
stream, write that stream out to a file and then shell
out to that file when needed.

I can access the embedded file by using
Reflection.Assembly.GetExecutingAssembly
().GetManifestREsourceStream("MyApp/RSYNC.exe")

But How do I write the stream to another file and shell
to it? Since it is an EXE I want to use streaming it to
a file work?

Use 'System.IO.BinaryWriter' to write the file, or use 'FileStream'
directly. Then you can use 'Shell' or
'System.Diagnostics.Process.Start' to start the application.
 
G

Guest

It would be easier to simply package the executable with the main assembly, deploy it, and run it using system.diagnostics.process. If you wanted to embed it though, you can do as the other replies say. However, I'd just add a little code to check for the executable's existence (using the IO.File.Exists function), and if it doesn't exist then use the code for extracting and writing it. (But I'm sure you were probably planning on doing that anyways.)
 
B

brian shannon

I am interested in your idea Ben. This is a new area of VB for me with
the packaging stuff.

Are you suggestion have my VB.NET DLL and my seperate EXE and deploy it
through an installer package or still have my EXE part of my VB.NET DLL?

Is it possible to have have an installer package part of a DLL? So when
the user runs the VB.NET DLL it will look for the EXE and if it's not
there then run the installer package?

If you have some spare time to tell me more in detail about how to do
this or what can be done, I would appreciate it.

I know how to use the System.IO class but am clueless with deployment!
If you decide or anyone else to help please talk as if I were in first
grade!

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top