cancel
Showing results for 
Search instead for 
Did you mean: 

Need UI-example for AddOnInstaller VS.NET 2002

Former Member
0 Kudos
227

Hi,

with SDk i got a lot of UI examples. all for VisualStudio.NET 2002 and 2003. But The AddOnInstaller example does not work with me VS.NET 2002. I cant open it.

I can open the frmInstaller.vb. so i get the main code. but i don't have the sub main an the Settings of the projekt properties.

Norbert

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If no one have an example maybe you can help me in another way.

the example uses:

<code>

1 Dim AddonExeFile As IO.FileStream

2 Dim thisExe As System.Reflection.Assembly

3 thisExe = System.Reflection.Assembly.GetExecutingAssembly()

4 Dim file As System.IO.Stream

5 file = thisExe.GetManifestResourceStream("AddOnInstaller.HelloWorld.exe")

6 AddonExeFile = IO.File.Create(path & "\HelloWorld.tmp")

7 Dim buffer() As Byte

8 ReDim buffer(file.Length)

9 file.Read(buffer, 0, file.Length)

10 AddonExeFile.Write(buffer, 0, file.Length)

11 AddonExeFile.Close()

</code>

In line 5 it specifies that there is a file packed in this exe-file i think.

How do i get the files of my AddOn packed to the installer executable?

thank you

Norbert

AdKerremans
Active Contributor
0 Kudos

add the files to your project and set the build action in the properties to embedded resource.

We have change the hardcoded resource names to a procedure that reads all resources and extracts them,

Just call this routine with the addon path as parameters

Private Sub ExtractFiles(ByVal path As String)

If Not IO.Directory.Exists(strDest) Then

IO.Directory.CreateDirectory(strDest) ' Create installation folder

End If

Dim thisExe As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()

For Each resourceName As String In thisExe.GetManifestResourceNames()

Dim AddonExeFile As IO.FileStream

Dim file As System.IO.Stream = thisExe.GetManifestResourceStream(resourceName)

' Create a tmp file first, after file is extracted change to exe

AddonExeFile = IO.File.Create(path & "\HelloWorld.tmp")

Dim buffer() As Byte

ReDim buffer(file.Length)

file.Read(buffer, 0, file.Length)

AddonExeFile.Write(buffer, 0, file.Length)

AddonExeFile.Close()

Dim FileName As String = Replace(resourceName, thisExe.GetName().Name + ".", "")

IO.File.Move(path & "\HelloWorld.tmp", path & "\" & FileName)

Next

End Sub

I hope this helps you a lot.

Answers (1)

Answers (1)

Former Member
0 Kudos

hello Ad

i think this could really solv my problem.

But i cant find the way to set the build action in the properties to embedded resource.

can you please help me again?

<edit>

20 Seconds after posting i got it. I have to change it in the properties of each embedded file.

thanks a lot!

Message was edited by: Norbert Friese