Generate a text/binary file during installation

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.
 
J

jvb

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
 
G

Guest

Hi jvb,
Actually the main problem is where to put this function call to make it
work during installation when using setup project?
 
J

jvb

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.
 

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