Generate a text/binary file during installation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all expert,
(I got no solution on deployment group)

I would like to know how I can execute my own vb .net function during
installation.
I had created my own setup project, but i don't know how can i make a text
file included the Client's Computer Name.

Thanks alot.
 
To get the current computers name use
System.Windows.Forms.SystemInformation.ComputerName. See if the
function below helps you out.

Private Function WriteComputerName() As Boolean

Dim strWriter As IO.StreamWriter
Dim boolReturn As Boolean

Try
strWriter = New IO.StreamWriter("<FLAT FILE LOCATION>")
Catch ex As Exception
Return False
End Try

Try
strWriter.WriteLine("Computer Name: " &
System.Windows.Forms.SystemInformation.ComputerName)
boolReturn = True
Catch ex As Exception
strWriter.WriteLine("Unable to determine computer name: " &
Err.Description)
boolReturn = False
Finally
strWriter.Close()
End Try

Return boolReturn

End Function
 
Hi jvb,
Actually the main problem is where to put this function call to make it
work during installation when using setup project?
 
You can place it anywhere in the install routine. I would place it at
the beginning of the project's execution so that you can have the
computer's name if the install fails.
 
Back
Top