N
Nige
I have an exe embedded in my vb.net application and I'm trying to extract it
at runtime, so i can execute it and then remove it.
my code is below
strm always is Nothing
any ideas.
thanks in advance
Dim asm As System.Reflection.Assembly =
System.Reflection.Assembly.GetExecutingAssembly()
Dim resourceName As String = asm.GetName().Name + ".filename.exe"
Dim strm As System.IO.Stream = asm.GetManifestResourceStream(resourceName)
Dim buffer() As Byte = New Byte(strm.Length) {}
strm.Read(buffer, 0, CInt(buffer.Length))
strm.Close()
Dim tempName As String = System.IO.Path.GetTempFileName()
Dim fs As New System.IO.FileStream(tempName, System.IO.FileMode.Create)
fs.Write(buffer, 0, CInt(buffer.Length))
fs.Close()
at runtime, so i can execute it and then remove it.
my code is below
strm always is Nothing
any ideas.
thanks in advance
Dim asm As System.Reflection.Assembly =
System.Reflection.Assembly.GetExecutingAssembly()
Dim resourceName As String = asm.GetName().Name + ".filename.exe"
Dim strm As System.IO.Stream = asm.GetManifestResourceStream(resourceName)
Dim buffer() As Byte = New Byte(strm.Length) {}
strm.Read(buffer, 0, CInt(buffer.Length))
strm.Close()
Dim tempName As String = System.IO.Path.GetTempFileName()
Dim fs As New System.IO.FileStream(tempName, System.IO.FileMode.Create)
fs.Write(buffer, 0, CInt(buffer.Length))
fs.Close()